标签:
思路:将所有NSFoundation中的类型记录到一个数组中,然后通过数组的
containsObject:方法去判断所要判断的类型是否包含在此数组中.
简单代码如下:
+ (BOOL)isClassFromFoundation:(Class)c {
NSArray* foundationClasses = @[@"NSObject", @"NSNumber",@"NSArray",@"NSMutableArray",@"NSData",@"NSMutableData",@"NSDate",@"NSDictionary",@"NSMutableDictionary",@"NSString",@"NSMutableString"];
//判断c是否在foundationClasses数组中
return [foundationClasses containsObject:c];
}
标签:
原文地址:http://www.cnblogs.com/iOS771722918/p/4452418.html