프로그램/iOS
[xcode 8, Swift 3] 경고(Alert)창 띄우기
로드러너
2016. 12. 22. 09:55
- 개발환경
xcode 8, Swift 3
- 코드
let dialog = UIAlertController(title: "제목", message: "내용", preferredStyle: .alert)
let action = UIAlertAction(title: "확인", style: UIAlertActionStyle.default)
dialog.addAction(action)
self.present(dialog, animated: true, completion: nil)
버튼을 눌렀을 때, 작업을 하기 원하면 아래와 같이
let action = UIAlertAction(title: "확인", style: UIAlertActionStyle.default){ (action: UIAlertAction) -> Void in
//수행하고자 하는 코드 추가
}