创建对象
NSNotification *notification =[NSNotification notificationWithName:@"touxiang" object:nil userInfo:dic];
[[NSNotificationCenter defaultCenter] postNotification:notification];
移除通知
[[NSNotificationCenter defaultCenter] removeObserver:self];或者
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"tongzhi" object:nil];
接受通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(InfoNotificationAction:) name:@"tongzhi" object:nil];
- (void)InfoNotificationAction:(NSNotification *)notification{
NSLog(@"%@",notification.userInfo);
}
网友评论