2017-12-29 35 views
1

신속하게 삭제 알림을 구현하려면 어떻게해야합니까? 그래서 만약 내가 삭제 버튼을 가지고 "당신은 확실합니다"알림 상자가 삭제 및 옵션을 취소 팝업, 난 info.plist에있을 줄 알았는데, 아무 것도 본 적이 없어, 아무도 도울 수 있습니까?신속하게 "삭제"알림을 구현하는 방법

+1

을 지금까지 시도 무엇입니까? – chrisz

+0

아무 것도 없지만 삭제 구현을 수행하는 방법을 알고 있지만 버튼을 눌렀을 때 팝업 알림을받는 방법을 알지 못합니다. – user9134986

+3

무엇을 묻고 있는지 명확하지 않습니다. 당신은 더 잘 설명해야합니다. 앱을 삭제하라는 알림을 푸시 알림으로 정의 했나요? 그리고 삭제 작업을 확인하도록 요청하는 메시지를 사용자에게 표시하려고합니까? 그렇다면 문제의 어떤 부분에 문제가 있습니까? –

답변

1

간편함 IBAction을 사용하여 코드에 코드를 연결하기 만하면 경고 코드를 작성하는 기능에 있습니다.

그래서 코드는이를 좋아한다 :

class ViewController: UIViewController { 

    @IBAction func showAlertButtonTapped(_ sender: UIButton) { 

     // create the alert 
     let alert = UIAlertController(title: "UIAlertController", message: "Would you like to continue learning how to use iOS alerts?", preferredStyle: UIAlertControllerStyle.alert) 

     // add the actions (buttons) 
     alert.addAction(UIAlertAction(title: "Continue", style: 

UIAlertActionStyle.default, handler: nil)) 
      alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler: nil)) 

      // show the alert 
      self.present(alert, animated: true, completion: nil) 
     } 

}