4

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?

mootymoots
  • 4,545
  • 9
  • 46
  • 74

2 Answers2

12

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.

Johannes Lumpe
  • 1,762
  • 13
  • 16
1

This might come in handy:

List of Classes that Support UIAppearance in iOS 5

James
  • 762
  • 8
  • 22