Search code examples
iphoneiosclassuiappearance

Checking for availability of UIAppearance


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?


Solution

  • 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.