UIAlertController

윤주현·2023년 7월 5일

UIKit

목록 보기
3/9

UIAlertController

import UIKit

class ViewController: UIViewController {
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        showAlert()
    }

    private func showErrorAlert() {
        let alert = UIAlertController(title: "Network Error",
                                      message: "Please check your network connectivity and try again.",
                                      preferredStyle: .alert)

        alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))

        present(alert, animated: true, completion: nil)
	}
}

0개의 댓글