您的位置:首页 > 移动开发 > IOS开发

IOS 通知

2015-12-03 14:46 344 查看
//监听
- (void)viewDidLoad {
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getServiceData) name:KHomePageViewController_getServiceData object:nil];
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:KHomePageViewController_getServiceData object:nil];
}


//发送
[[NSNotificationCenter defaultCenter] postNotificationName:KHomePageViewController_getServiceData object:nil];


Warning: 因为监听执行的代码的线程为发送者所在线程。为了确保线程正确,请手动添加合适线程。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: