UIAlertView/UIAlertController iOS 7 and iOS 8 compatibility

后端 未结 14 1557
暗喜
暗喜 2020-11-28 22:31

I am using Swift to write an app and I need to show an alert. The app must be iOS 7 and iOS 8 compatible. Since UIAlertView has been replaced with UIAlert

14条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 22:53

    I was annoyed that I kept having to write out both situations, so I wrote a compatible UIAlertController that works for iOS 7 as well so I just threw it up on GitHub. I did my best to replicate the (much better) methods of adding buttons and actions of the UIAlertController. Works with both Objective-C and Swift. I'm posting this as I found this question when searching on Google and figured it could be helpful for others.

    https://github.com/BayPhillips/compatible-alert-controller

提交回复
热议问题