iOS9中提示框UIAlertController的用法

 

import UIKit

class ViewController: UIViewController {

//按钮的点击事件

@IBAction func clickedBtn(sender: AnyObject) {

//print(“click ok”)

let btnAlert = UIAlertController()

btnAlert.title = “系统提示”;

btnAlert.message = “这已经点击过了这个按钮”

 

//cancel按钮

let cancelAction = UIAlertAction(title: “cancel”, style: UIAlertActionStyle.Cancel, handler: nil)

 

//ok按钮

let okAction = UIAlertAction(title: “ok”, style: UIAlertActionStyle.Default){

(action: UIAlertAction!) -> Void in

print(“you choose ok”)

}

 

//将提示信息与用户扣作行为绑定

btnAlert.addAction(cancelAction)

btnAlert.addAction(okAction)

 

//

self.presentViewController(btnAlert, animated: true, completion: nil)

 

}

 

 

override func viewDidLoad() {

super.viewDidLoad()

// Do any additional setup after loading the view, typically from a nib.

}

override func didReceiveMemoryWarning() {

super.didReceiveMemoryWarning()

// Dispose of any resources that can be recreated.

}

}

21 thoughts on “iOS9中提示框UIAlertController的用法

  1. Pingback: real estate for sale in Winston Salem NC

  2. Pingback: xe88 apk

  3. Pingback: forum

  4. Pingback: เมไหน ไฟแรงเฟอร์ ซูม

  5. Pingback: fun88

  6. Pingback: Bali,Indonesia

  7. Pingback: cbd oil

  8. Pingback: bed bug extermination

  9. Pingback: Singles clubs

  10. Pingback: 안전토토사이트

  11. Pingback: replica cheap omega imitation watches

  12. Pingback: judi online

  13. Pingback: porn

  14. Pingback: satta king

  15. Pingback: 카지노사이트

  16. Pingback: 바카라 사이트 홍보

  17. Pingback: Eddie Frenay

  18. Pingback: 온라인 카지노

  19. Pingback: albuterol inhaler generic cost

  20. Pingback: cialis tadalafil

  21. Pingback: kasim ayi

Comments are closed.