NSNotificationCenter的使用

1.注册NSNotificationCenter,并设置关联html

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.htmlpost

相关文章
相关标签/搜索