下記をコピペして使用する。
設定方法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
// アクションシート let alert = UIAlertController(title:"title", message: "message", preferredStyle: UIAlertControllerStyle.actionSheet) let action1 = UIAlertAction(title: "button1", style: UIAlertActionStyle.default, handler: { (action: UIAlertAction!) in }) let action2 = UIAlertAction(title: "button2", style: UIAlertActionStyle.default, handler: { (action: UIAlertAction!) in }) let cancel = UIAlertAction(title: "キャンセル", style: UIAlertActionStyle.cancel, handler: { (action: UIAlertAction!) in print("キャンセルをタップした時の処理") }) alert.addAction(action1) alert.addAction(action2) alert.addAction(cancel) self.present(alert, animated: true, completion: nil) |
コメントを残す