How can I determine if the device that is running my app is ios 5?
I’m trying to use the UIAppearance class but it will give an error if it’s running on ios versions other than 5. so I want to have if statement that only runs this line of code if the device is ios5.
Thanks,
EDIT:
SO here is the solution,
float version = [[[UIDevice currentDevice] systemVersion] floatValue];
if (version >= 5.0){
[[UINavigationBar appearance] setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
}
You can get the OS version using
But a better way would be to check for specific features, Something along the lines of
To see if that class is available, then perform you operations.
Failing that it is also possible to make sure you only build for iOS 5, and it will only install on iOS 5 devices.