import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBOutlet weak var myLabel: UILabel!
@IBAction func click(_ sender: Any) {
let alert = UIAlertController(title: "警告", message: "按钮被点击了", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "知道啦", style: .default,handler: nil))
self.present(alert, animated: true,completion: nil)
myLabel.text = "IOS" + String(arc4random_uniform(10))
}
}
初始UIKit之alert
最新推荐文章于 2025-05-18 20:41:53 发布