Mobile/iOS

[iOS/swift] UIAlertController addTextField

out of coding 2018. 1. 3. 18:07

우리는 UIAlertController를 사용하여야 합니다.


그래서 이걸 사용하면서 입력을 할 수 있도록 하여야 합니다.


1
2
3
4
5
6
7
8
9
10
11
let alert = UIAlertController(title: "Title", message: "Message", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { _ in
    // Not
}))
alert.addTextField { textField in
    textField.placeholder = "DH"
}
 
self.present(alert, animated: true) {
    
}
cs


아주 쉽네요.

ㅎㅎ