Check UIAppearance Availability

I am trying to check for the existence of the UIAppearance class using:

NSClassFromString(@"UIAppearance") 

However, this returns nil from iOS4 and iOS5 - who has any tips on how to get around this?

+4
source share
2 answers

UIAppearance is not a class, it is a protocol. Therefore, to check if this exists or not, you should use:

 NSProtocolFromString(@"UIAppearance"); 

It returns null in <iOS5, but an object on iOS5.

+12
source
+1
source

Source: https://habr.com/ru/post/1411061/


All Articles