문제

It always return a NULL instead of the property.

objc_property_t property = class_getProperty([UIView class], "frame");
XCTAssertTrue(property != NULL,
              @"UIView.frame property should be here.");

Works fine with center for example, but with frame seems not.

Can anybody explain this?

도움이 되었습니까?

해결책

Whoa, seems it does not have such property indeed, but a method. Documentation shows as a property, but in reality it is a method. https://github.com/JaviSoto/iOS7-Runtime-Headers/blob/master/Frameworks/UIKit.framework/UIView.h

Weird.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top