码迷,mamicode.com
首页 > 其他好文 > 详细

NSNotificationCenter的使用

时间:2014-10-19 16:54:30      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   os   ar   使用   sp   

1.注册NSNotificationCenter,并设置关联

1 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getArray:) name:@"getArray" object:nil];
2 
3 - (void)getArray:(NSNotification*)aNotification
4 {
5     //接收传过来的数组,数组中存有Status类的对象
6     self.statusArr = aNotification.object;
7 }

2.消息发送(带参)

1 //将tempArr数组通过消息中心发送到@"getArray" 这个名字的消息对应的方法中
2 [[NSNotificationCenter defaultCenter] postNotificationName:@"getArray" object:tempArr];

补充:IOS本地通知UILocalNotification的使用,参考地址->http://www.cnblogs.com/lan0725/p/3195263.html

NSNotificationCenter的使用

标签:style   blog   http   color   io   os   ar   使用   sp   

原文地址:http://www.cnblogs.com/zw-h/p/4035017.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!