swift 带有UIAlertAction的UIAlertController
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了swift 带有UIAlertAction的UIAlertController相关的知识,希望对你有一定的参考价值。
var textField = UITextField()
let alert = UIAlertController(title: "Add New Todoey Item", message: "", preferredStyle: .alert)
let action = UIAlertAction(title: "Add Item", style: .default) { (action) in
self.itemArray.append(textField.text!)
}
alert.addTextField { (alertTextField) in
alertTextField.placeholder = "Create new item"
textField = alertTextField
}
alert.addAction(action)
present(alert, animated: true, completion: nil)
以上是关于swift 带有UIAlertAction的UIAlertController的主要内容,如果未能解决你的问题,请参考以下文章
在 Swift 中创建 UIAlertAction
Swift 3.0 中的 UIAlertAction 内的 UIAlertView ?
在 UIAlertController 中的 UIAlertAction 中将图像居中
UIAlertController
UIAlertController
UIAlertAction 按钮文本左对齐