swift 广播
2015-08-08 11:50
585 查看
[code]var obj = Dictionary<String,String>() obj[Consts.Brocast.NotifyOp] = "222222222222" NSNotificationCenter.defaultCenter(). postNotificationName(Consts.BrocastName.NotifyCome, object: obj)
[code]func ReceiveNotification(){ NSNotificationCenter.defaultCenter(). name: Consts.BrocastName.NotifyCome, object: nil) } func OnReceive(sender :NSNotification){ if let info = sender.object as? NSDictionary{ if let op = info[Consts.Brocast.NotifyOp] as? String{ let alert:UIAlertView = UIAlertView(title: op, message: "333333", delegate: self, cancelButtonTitle: "ok") alert.show() } } }
相关文章推荐
- swift新手入门视频教程-08-枚举
- [IOS] Swift enum and Struct
- iPhone开发入门系列2(iOS8+Swift版)备忘录APP学习01
- Swift学习笔记(二十三)——Swift泛型初识
- Swift学习笔记(二十二)——字典的基本操作
- Swift学习笔记(二十一)——字典
- Swift编程语言学习4.1——周期
- iOS- Swift:如何使用iOS8中的UIAlertController
- swift封装的跑马灯效果
- Swift学习笔记(二十)——数组的基本操作
- [ios] Swift Closure(闭包)
- swift 代码加载xib storyboard
- swift学习笔记
- 【Swift】沙盒缓存
- Ray Wenderlich的swift教程01--推荐资料
- [ios] Swift Basis
- iOS开发实战教学:在Swift怎样创建CocoaPod?
- iPhone开发入门系列1(iOS8+Swift版)天天打靶APP学习15-16
- swift2.0学习之拓展
- swift public、internal和private