ios8 notification in swift

时间:2014-09-11 15:27:42   收藏:0   阅读:300

AppDelegate.swift

bubuko.com,布布扣

ViewController.swift

bubuko.com,布布扣

运行,按下 command + L / command + H 使模拟器处于锁屏状态/主屏幕,效果如下

bubuko.com,布布扣      bubuko.com,布布扣

下面处理 First Action 和 Second Action 的点击事件:

还是在AppDelegate.swift中,

bubuko.com,布布扣

然后在ViewController.swift 中接收通知并处理,

bubuko.com,布布扣

具体的效果自己运行一下就可以看到了,这里就不贴出来了。

另外,在模拟器的 Settings ->  Notifications -> Notifications ->  可以设置通知的弹出样式,有3种样式可以选择(先运行一下程序然后在Settings中才可以看到Notifications选项)

bubuko.com,布布扣

完。

原文:http://blog.csdn.net/chaoyuan899/article/details/39203457

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!