标签:ios notification 基本用法
1 基本用法
添加观察(可能很多页面)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeIntlCode:) name:NOTIFICATION_SUCCESS_SELECT_INTLCODE object:nil];
发出通知(可能只有一个页面)
[[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICATION_SUCCESS_SELECT_INTLCODE object:nil userInfo:[NSDictionary dictionaryWithObject:model forKey:@"selectedIntlCodeModel"]];
在 dealloc中移除监听
[[NSNotificationCenter defaultCenter] removeObserver:self name:NOTIFICATION_SUCCESS_SELECT_INTLCODE object:nil];
IOS中NSNotification使用笔记,布布扣,bubuko.com
标签:ios notification 基本用法
原文地址:http://blog.csdn.net/xdrt81y/article/details/28436665