iOS alert message box 만들기
메세지 박스 만들기.
경고 문구나, 각종 알람 메세지를 띄우려면 메세지 박스가 필요 합니다.
요럴때 써 먹을 수 있는 메세지 박스 하나 구현해 봅니다.
예를 들면 요런거죠
OK 누르면 닫히는거죠.
간단합니다.
참고소스 (swift 4)
func alertMsgBox(strTitle : String, strMessage : String) {
let alert = UIAlertController(title: strTitle,
message: strMessage,
preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "OK",
style: .default,
handler: { action in
switch action.style{
case .default:
self.prtDbg(str:"default")
case .cancel:
self.prtDbg(str:"cancel")
case .destructive:
self.prtDbg(str:"destructive")
}
}))
self.present(alert, animated: true, completion: nil)
}
가져가실때는 출처는 꼭 밝혀 주세요.
감사합니다.