UIAlertController if iOS 8, otherwise UIAlertView

后端 未结 11 2024
清酒与你
清酒与你 2020-12-16 10:19

I want to conform to the UIAlertController used in iOS 8 since UIAlertView is now deprecated. Is there a way that I can use this without breaking support for iOS 7? Is there

11条回答
  •  不知归路
    2020-12-16 10:49

    Please see the answer of Erwan (below my answer) as I see it is the best.

    --

    You can check the iOS version to use appropriate control like this:

    if (([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] == NSOrderedAscending)) {
        // use UIAlertView
    }
    else {
        // use UIAlertController
    }
    

提交回复
热议问题