How to call initWith… in swift

后端 未结 4 727
忘掉有多难
忘掉有多难 2021-01-25 07:52

I have a an objective-c class (RDAlertView) which create an Alert (UIAlertView for ios < 8 and UIAlertController for ios >=8 )

Here is the code in Object

4条回答
  •  旧时难觅i
    2021-01-25 08:16

    UIAlertView is deprecated in iOS 8.

    You can show an alert with this code:

    var alert = UIAlertController(title: "Alert", message: "test", preferredStyle: UIAlertControllerStyle.Alert)
    
    alert.addAction(UIAlertAction(title: "Click", style: UIAlertActionStyle.Default, handler: nil))
    
    self.presentViewController(alert, animated: true, completion: nil)
    

提交回复
热议问题