How to call initWith… in swift

后端 未结 4 773
忘掉有多难
忘掉有多难 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条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-25 08:11

    UIAlertView.showWithTitle("Hello", message: "Hello World", cancelButtonTitle: "Okay") { alertView, buttonIndex in
    
    // Do something when the alert view is clicked
    
    let anAlertView = UIAlertView(title: "Choice", message: "Pick one", cancelButtonTitle: "No", otherButtonTitles: "Yes", "Maybe")
    
    anAlertView.showWithCompletion { alertView, buttonIndex in
    
    switch buttonIndex
    {
       case 1: println("Yes")
       case 2: println("Maybe")
       default: println("No")
    }
    }
    

提交回复
热议问题