消息中心 NSNotificationCenter
来源:互联网 发布:linux lcd 设备文件 编辑:程序博客网 时间:2024/05/05 17:55
消息中心传值总共分为三部分:
第一步:
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(changeAction:) name:@"CHANGEARRAY" object:Nil];
分析:
defaultCenter,消息中心只有一个,通过类方法获取它的单例
addObserver: 一般为self
name : 暗号 一般为大写
object : nil 为公共的
第二步:
-(void)changeAction:(NSNotification *)noti
{
//接受传回来的参数 然后接受
NSDictionary * dic = [noti userInfo];
//然后执行其他的方法
}
第三步:
//进行传值
[[NSNotificationCenter defaultCenter]postNotificationName:@"CHANGEARRAY" object:Nil userInfo:dic];
分析:
postNotificationName:对暗号 与前面暗号一致
userInfo : 想传得参数
0 0
- 消息中心 NSNotificationCenter
- 消息中心NSNotificationCenter理解
- 消息中心 NSNotificationCenter
- 消息中心 NSNotificationCenter
- 消息中心 NSNotificationCenter
- NSNotificationCenter消息中心
- 消息中心和观察者:NSNotificationCenter
- ios-消息中心 NSNotificationCenter
- iOS 通知中心 NSNotificationCenter(消息机制)
- ios-消息中心 NSNotificationCenter 的介绍
- iOS设计模式之NSNotificationCenter 消息中心
- 通知中心NSNotificationCenter
- 通知中心 NSNotificationCenter
- IOS NSNotificationCenter 通知中心
- 通知中心(NSNotificationCenter)
- NSNotificationCenter 通知中心
- 通知中心NSNotificationCenter
- NSNotificationCenter通知中心
- Java EE HTML5 WebSocket 示例
- MySQL互为主从模型实现基于SSL复制
- 树的直径学习小记 Poj 1985 Cow Marathon+Poj 2631 Roads in the North
- 项目经理需要的十项基本技能
- zigbee中profile,cluster的认识【转】
- 消息中心 NSNotificationCenter
- iphone导航条的显示与隐藏
- SAX和DOM解析XML文档
- sql插入某些固定数据和其他子查询结果
- 享元模式
- 一篇%3CDIV%20style%3D%22FONT-SIZE%
- Java反射学习总结二(用反射调用对象的私有属性和方法)
- 关于Images.xcassets
- hdu 3038 How Many Answers Are Wrong(并查集)