标签:
isKindOfClass:[NSObject class]
isMemberOfClass:[NSObject class]
conformsToProtocol:@protocol(NSCopying)
respondsToSelector:@selector(showMessage:)
动态生成一个类
NSString *className=@"Person"; Class myClass=NSClassFromString(className)
可以用 myClass 初始化Person对象
Person *person2=[[myClass alloc]init]
NSStringFromClass(myClass),NSStringFromClass([Person class]
NSString *methodName=@"showMessage:" // 方法名字符串
SEL mySelector=NSSelectorFromString(methodName); // 根据方法名字符串 创建SEL对象
NSStringFromSelector(mySelector)
标签:
原文地址:http://blog.csdn.net/xy_26207005/article/details/51523482