iOS Swift NSNotificationCenter 通知
来源:互联网 发布:软件开发招标书 编辑:程序博客网 时间:2024/06/05 07:26
1. NSNotification : 一个对象状态变化时通过NSNotification通知另一个或多个对象 (观察者模式 Observer);
2. 发送通知:
let dic =myvalue
NSNotificationCenter.defaultCenter().postNotificationName("Name", object: dic)
3. 接收通知:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "Myfunc:", name: "Name", object: nil)
func Myfunc(notification:NSNotification) {
let getStr = notification.objectas! String //这里以通知内容为字符串类型为例
print("收到通知:"+getStr)
}
deinit{
NSNotificationCenter.defaultCenter().removeObserver(self)
}
/*
持续完善更新中...
*/
1 0
- iOS Swift NSNotificationCenter 通知
- IOS 之 通知NSNotificationCenter
- IOS NSNotificationCenter 通知中心
- IOS NSNotificationCenter 通知中心
- iOS通知中心(NSNotificationCenter)
- iOS通知:NSNotificationCenter
- IOS NSNotificationCenter 通知使用方法
- iOS通知中心NSNotificationCenter
- iOS NSNotificationCenter 通知
- IOS通知中心(NSNotificationCenter)
- iOS通知 NSNotificationCenter
- Swift - 使用NSNotificationCenter发送通知,接收通知
- iOS 通知中心 NSNotificationCenter & NSNotification
- iOS 通知中心 NSNotificationCenter & NSNotification
- iOS 通知中心 NSNotificationCenter & NSNotification
- iOS 通知中心 NSNotificationCenter & NSNotification
- ios 通知中心 NSNotificationCenter & NSNotification
- iOS开发 - 通知中心(NSNotificationCenter)
- 微信小程序ajax异步加载
- 面试题3
- 激活office2016(上海理工大学校内激活)
- 移动端a链接href属性的一些妙用
- 下面要看的文件列表
- iOS Swift NSNotificationCenter 通知
- 简单的Mysql数据库备份和同步脚本
- (OK) Linux 平台 CUST.zip 制作方法
- 每天一个linux命令(52):ifconfig命令
- Cocos Creator Box2d 学习笔记-02
- 程序员绩效之谜
- 【性能优化】性能优化---Hierarchy Viewer的使用
- linux test 命令
- 精进:如何成为一个很厉害的人