swift 学习之hello窗口弹出

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import UIKit

class ViewController: UIViewController {
@IBAction func touch(_ sender: UIButton) {
print("halo")
let ac = UIAlertController(title: "message", message: "Do U Love Me", preferredStyle: .alert)
let btn = UIAlertAction(title: "Yes,I do", style: .default, handler: nil)
ac.addAction(btn)
self .present(ac, 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.
}
}