最详细的IOS NSNotification通知解析
来源:互联网 发布:tera mac 编辑:程序博客网 时间:2024/06/09 19:02
太多理论性的东西就不说了,就说一个疑惑,三个个主意点。
一个疑惑就是我们在UIViewController中注册的通知观察者,不需要我们在UIViewController中手动移除,系统也会帮助我们自动移除,如果需要验证这个问题,你只需要扩展UINotificationCenter然后重写它的removeObsever:函数就可。
三个注意点:
1.我们如果要想移除通知观察者一定要指定特定的通知名字,要么这个UIViewController中所有的通知都会被移除
2.我们不要重复添加通知观察者
3.我们在使用Block接收通知的内容的时候,一定要注意强引用,千万不要出现block跟self之间纯在循环引用,造成内存泄露
好了不说了实例代码如下:
结果:
0 0
- 最详细的IOS NSNotification通知解析
- iOS NSNotification 通知的用法
- iOS NSNotification 通知的使用
- ios NSNotification通知的使用
- iOS NSNotification的使用 通知
- iOS NSNotification(通知)的使用
- iOS 通知的使用NSNotification的使用
- IOS NSNotification Center 通知中心的使用
- iOS通知NSNotification传值的使用
- 【iOS系列】- 通知NSNotification的使用
- iOS 消息通知-NSNotification
- iOS开发-通知NSNotification
- ios 通知NSNotification
- iOS 通知 NSNotification
- iOS -- 通知NSNotification
- NSNotification IOS通知中心
- iOS NSNotification 通知机制
- ios -- NSNotification(通知)
- Pyqt QImage 与 np array 转换
- 百度地图4G无法定位
- codevs 3160 最长公共子串
- 把一个整形数组中重复的数字去掉
- SimpleDateFormat常用函数语法
- 最详细的IOS NSNotification通知解析
- Kubernetes安装之证书验证
- 【Python】TypeError: 'module' object is not callable 原因分析
- 基于MySQL服务器的性能优化
- jQuery的层次选择器
- java 爬楼梯算法实现
- Android-自定义Google logo及区域处理
- 如何调整eclipse字体大小
- SIFT原理与源码分析:DoG尺度空间构造