class VIEwController: UIVIEwController { @IBOutlet weak var message: UILabel! @IBOutlet weak var myNotification: UILabel! overrIDe func vIEwDIDLoad() { super.vIEwDIDLoad() NSNotificationCenter.defaultCenter().addobserver(self,selector: #selector(VIEwController.updateInterface(_:)),name: UIApplicationWillEnterForegroundNotification,object: nil) } func updateInterface (notification: NSNotification){ myNotification.text = "Back to background with notification" } overrIDe func dIDReceiveMemoryWarning() { super.dIDReceiveMemoryWarning() } }@H_502_1@按下home键之后,myNotification的text永久的改为 "Back to background with notification" 总结以上是内存溢出为你收集整理的swift程序进入后台全部内容,希望文章能够帮你解决swift程序进入后台所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
概述class ViewController: UIViewController { @IBOutlet weak var message: UILabel! @IBOutlet weak var myNotification: UILabel! override func viewDidLoad() { super.viewDidLoad(
赞
(0)
打赏
微信扫一扫
支付宝扫一扫
Swift3.0新特性和改动
上一篇
2022-05-26
swift两个视图控制器之间的传值
下一篇
2022-05-26
评论列表(0条)