Reputation: 865
UIButtonTypeSystem is not defined in iOS 6
if I put the following code will crash the app ?
if(appSetting.iOSVersion>=7){
photo = [UIButton buttonWithType:UIButtonTypeSystem];
}else{
photo = [UIButton buttonWithType:UIButtonTypeRoundedRect];
}
How to code to to check if UIButtonTypeSystem defined and prevent crashing?
Upvotes: 0
Views: 156
Reputation: 1864
If you need to support iOS 6 then use UIButtonTypeRoundedRect instead of UIButtonTypeSystem. It will then work under both iOS 6 and 7. In the docs it states:
UIButtonTypeSystem A system style button, such as those shown in navigation bars and toolbars. Available in iOS 7.0 and later.
Upvotes: 1