通知中心用的不是很熟。
只知道一個簡單的信息發送,信息接受。
//信息發送
[[NSNotificationCenter defaultCenter] postNotificationName:@"hehe" object:nil userInfo:@{[NSString stringWithFormat:@"%ld",count]:@"key"}];
//註冊通知接收者
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(NSNotificationCenterMethod:) name:@"hehe" object:nil];
//退出的時候移除
[[NSNotificationCenter defaultCenter] removeObserver:self];
- (void)NSNotificationCenterMethod :(NSNotificationCenter *)userinfo {
NSLog(@"userinfo :%@",userinfo);
}
後續再補充...