NSNotification与delegate的区别
来源:互联网 发布:外汇实时汇率软件 编辑:程序博客网 时间:2024/04/29 01:41
简明概要的说明了NSNotification与delegate的区别:
1.效率肯定是delegate比nsnotification高。
2. delegate方法比notification更加直接,最典型的特征是,delegate方法往往需要关注返回值,也就是delegate方法的结果。比如-windowShouldClose:,需要关心返回的是yes还是no。所以delegate方法往往包含should这个很传神的词。也就是好比你做我的delegate,我会问你我想关闭窗口你愿意吗?你需要给我一个答案,我根据你的答案来决定如何做下一步。相反的,notification最大的特色就是不关心接受者的态度,我只管把通告放出来,你接受不接受就是你的事情,同时我也不关心结果。所以notification往往用did这个词汇,比如NSWindowDidResizeNotification,那么nswindow对象放出这个notification后就什么都不管了也不会等待接受者的反应。
- NSNotification与delegate的区别
- Delegate与NSNotification的区别
- Delegate与NSNotification区别
- NSNotification和Delegate的区别
- NSNotification、delegate和KVO的区别
- NSNotification、delegate和KVO的区别
- NSNotification、delegate和KVO的区别
- NSNotification、delegate和KVO的区别
- NSNotification、delegate和KVO的区别
- NSNotification、delegate和KVO的区别
- NSNotification、delegate和KVO的区别
- NSNotification、delegate和KVO的区别
- NSNotification、delegate和KVO的区别
- NSNotification、delegate和KVO的区别
- NSNotification、delegate和KVO的区别
- NSNotification、delegate和KVO的区别
- NSNotification、delegate和KVO的区别
- NSNotification、delegate和KVO的区别
- 网页中加入baidu搜索
- Lucene和Solr 学习目录
- 10月24日,成为程序员的节日
- 如何解决“Internet Explorer停止工作”
- android 铃声设置流程
- NSNotification与delegate的区别
- 一个破解md5加密的网站
- vi常用命令
- 得到文件路径
- 谈谈SSH三大框架
- Window.Close();Window.Open();
- VS2010 C++目录配置
- 努力迎接灿烂的明天
- Socket编程基础(转)