草庐IT

copyPropertyList

全部标签

ios - 所有子类的 class_copyPropertyList 也

这里是解释ListofclasspropertiesinObjective-C如何使用class_copyPropertyList在运行时获取类的所有属性。我已经测试过了,它工作正常。我注意到它只会从该类获取属性,而不是它的子类。代码:@interfaceJustForThisUT:NSObject@propertyNSUIntegerpublic_access;@end@interfaceJustForThisUT()@propertyNSUIntegerprivate_access;@end@implementationJustForThisUT@end@interfaceJust

ios - 我无法通过 class_copyPropertyList 使用 swift 获取类的属性

classfuncgetPropertiesInfo()->(propertiesName:[String],propertiesType:[String]){varpropertiesName:[String]=Array();varpropertiesType:[String]=Array();varoutCount:UInt32=0;vari:Int=Int();varproperties:UnsafePointer=class_copyPropertyList(object_getClass(self),&outCount);println("\(outCount)");}我使