takaishota
4/26/2017 - 7:10 AM

ActionSheet表示

ActionSheet表示

let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
        
        let action1 = UIAlertAction(
            title: "xxxxする", // text is blue
            style: .default,
            handler: { ( action : UIAlertAction) -> Void in
                // todo
        })
        let action2 = UIAlertAction(
            title: "xxxxする", // text is red
            style: .destructive,
            handler: { ( action : UIAlertAction) -> Void in
                // todo 
        })
        let cancelAction = UIAlertAction(
            title: "キャンセル",
            style: .cancel,
            handler: { ( action : UIAlertAction) -> Void in
                // nop
        })
        
        alert.addAction(action1)
        alert.addAction(action2)
        alert.addAction(cancelAction)
        
        self.present(alert, animated: true, completion: nil)