Objective-C 2.0 Runtime Programming Guide에 설명 된 Objective-C 클래스의 모든 속성을 나열하려고 시도했습니다.Objective-C 2.0 : class_copyPropertyList(), 카테고리에서 속성을 나열하는 방법
id LenderClass = objc_getClass("UIView");
unsigned int outCount, i;
objc_property_t *properties = class_copyPropertyList(LenderClass, &outCount);
for (i = 0; i < outCount; i++) {
objc_property_t property = properties[i];
fprintf(stdout, "%s %s\n", property_getName(property), property_getAttributes(property));
}
그러나 다음 세 가지 속성 만 나열됩니다.
userInteractionEnabled Tc,GisUserInteractionEnabled
layer [email protected]"CALayer",R,&,V_layer
tag Ti,V_tag
UIView.h 그것들은 클래스에서 직접 선언 한 세 가지 속성입니다. 다른 UIView 속성은 범주를 통해 추가됩니다.
카테고리에서 오는 것을 포함하여 클래스의 모든 속성을 얻으려면 어떻게해야합니까?
나는 iPhone 시뮬레이터 (iPhone SDK 2.2.1), btw로 이것을 시도했다. (중요한 경우).
아마도 CALayer로 인해 동적으로 선언되고 합성되지 않았습니까? 그러므로 보이지 않습니까? – hfossli