//发送通知到 (在需要的地方发送通知, 信息储存在
userInfo(字典类型)
)
[[NSNotificationCenter defaultCenter] postNotificationName:NSNOTIFICATION_TAG object:self userInfo:userInfo];
//z在需要的地方接受通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(messageNotifacation:) name:NSNOTIFICATION_TAG object:nil];
//方法
- (void)messageNotifacation:(NSNotification *)notification {
NSDictionary *userInfo = notification.userInfo;
信息可以从userInfo中取出
}
注:"NSNOTIFICATION_TAG" 我们自定义的标识符