检查UIAppearance的可用性(Checking for availability of UIAppearance)
我正在尝试使用以下命令来检查UIAppearance类的可用性:
NSClassFromString(@"UIAppearance")然而这从iOS4和iOS5返回零 - 任何人都有关于如何解决这个问题的提示?
I'm trying to check for the availability of the UIAppearance class using:
NSClassFromString(@"UIAppearance")However this returns nil from both iOS4 and iOS5 - anyone got any tips on how to work around this?
最满意答案
UIAppearance不是一个类,它是一个协议。 所以为了检查它是否存在,你可以使用:
NSProtocolFromString(@"UIAppearance");它在<iOS5上返回null,但是在iOS5上返回一个对象。
UIAppearance is not a class, it is a protocol. So in order to check wether it exists or not, you would use:
NSProtocolFromString(@"UIAppearance");It returns null on < iOS5, but an object on iOS5.
更多推荐
发布评论