I need my app to support iOS 5+. Since prior iOS 6 the enum lineBreakMode
for line break mode in UILabel
is of type UILineBreakMode
, and it is of type NSLineBreakMode
for iOS 6+, what should be the best (or more correct) way to check the iOS version currently running to determine the type to be used? Is it correct to directly do something like [[UIDevice currentDevice] systemVersion]
, or is there a better way?
Thanks!
You do not need to check the iOS version at runtime, the enum values are the same, the compiled code will not be changed when moving from
UILineBreakMode
toNSLineBreakMode
In case you want to check for the OS version you can use this code: