아이폰

Swift Alert, Confirm(얼럿, 컨펌 확인창)

SourceTree 2021. 11. 18. 19:51
반응형

1. Alert

let alert = UIAlertController(title: "알림", message: "얼럿 메세지 입니다.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "확인", style: .default) { action in
  //처리...
})
self.present(alert, animated: true, completion: nil)

 

2. Confirm

let alert = UIAlertController(title: "알림", message: "로그인 하시겠습니까?", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "취소", style: .default) { action in
  //취소처리...
})
alert.addAction(UIAlertAction(title: "확인", style: .default) { action in
  //확인처리...
})
self.present(alert, animated: true, completion: nil)
반응형