Swift
// 建立一個提示框
let alertController = UIAlertController(
title: "提示",
message: "請輸入價格或數量",
preferredStyle: .alert)
// 建立[確認]按鈕
let okAction = UIAlertAction(
title: "確認",
style: .default,
handler: {
(action: UIAlertAction!) -> Void in
print("按下確認後的動作")
})
alertController.addAction(okAction)
// 顯示提示框
self.present(
alertController,
animated: true,
completion: nil)