NSNotificationCenter的使用

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

posted @ 2014-10-19 16:01  纠纠结结  阅读(193)  评论(0编辑  收藏  举报