Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 386
mootymoots Avatar asked Dec 13 '22 02:12

mootymoots


2 Answers

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.

like image 157
Johannes Lumpe Avatar answered Dec 30 '22 05:12

Johannes Lumpe


This might come in handy:

List of Classes that Support UIAppearance in iOS 5

like image 20
James Avatar answered Dec 30 '22 03:12

James