Alertviewcontroller- til12
Alert & Action sheet
UIAlertControllerClass를 통해 Aler나 Action sheet를 구성한 후, 메서드를 사용하여 사용자에게 모달로 보여준다.
UIAlertController Class
주요프로퍼티
- preferredStyle : alert와 actionSheet로 나뉜다.
- UIAlertController.Style : enum으로 정의된 해당 타입은 actionSheet와 alert로 구성된다.
주요메서드
addAction(UIAlertAction) : alert와 actionSheet에 액션을 추가
addTextField: alert를 통해서 텍스트 입력받고자 할때 텍스트 필드를 추가한다. 이때, actionSheet에서는 사용할 수 없기 때문에, actionSheet에 추가시 runtime error가 발생한다. 이에대한 근거는 apple developer document의 "UIAlertController "에서 찾을 수 있다.
When configuring an alert with the UIAlertController.Style.alert style, you can also add text fields to the alert interface.
댓글
