๐ŸŽ iOS/UIkit

[UIkit] Alert

JerryiOS 2023. 3. 27. 21:17

Alert

func popUp() {
    let alert = UIAlertController(title: "์•Œ๋ฆผ์ฐฝ์ด๋ฆ„", message: "์•Œ๋ฆผ์ฐฝ ๋ฉ”์‹œ์ง€", preferredStyle: .alert)
    let success = UIAlertAction(title: "ํ™•์ธ", style: .default) { action in
        print("ํ™•์ธ๋ฒ„ํŠผ์ด ๋ˆŒ๋ ธ์Šต๋‹ˆ๋‹ค.")
    }
    let cancel = UIAlertAction(title: "์ทจ์†Œ", style: .cancel) { cancel in
        print("์ทจ์†Œ๋ฒ„ํŠผ์ด ๋ˆŒ๋ ธ์Šต๋‹ˆ๋‹ค.")
    }

    alert.addAction(success)
    alert.addAction(cancel)

    present(alert, animated: true) {
        print("์™„๋ฃŒ๋˜์—ˆ์Œ")
    }
}

 

๋ฐ˜์‘ํ˜•