let alert = UIAlertController(title: "Alert", message: "Message", preferredStyle: UIAlertControllerStyle.Alert)

        alert.addAction(UIAlertAction(title: "Click", style: UIAlertActionStyle.Default, handler: nil))

        self.presentViewController(alert, animated: true, completion: nil)

        alert.addAction(UIAlertAction(title: "lala", style: UIAlertActionStyle.Cancel, handler: { (action) in

            switch action.style{

            case .Default:

                print("default")

                

            case .Cancel:

                print("cancel")

                

            case .Destructive:

                print("destructive")

            }

        }))

        

        alert.addAction(UIAlertAction(title: "Ok", style: .Default, handler: { action in

            switch action.style{

            case .Default:

                print("default")

                

            case .Cancel:

                print("cancel")

                

            case .Destructive:

                print("destructive")

            }

        }))

posted on 2015-12-30 15:33  丑蛋蛋  阅读(301)  评论(0编辑  收藏  举报