接收
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receive:) name:@"zhibintest" object:nil];
-(void)receive:(NSNotification *)center{
NSDictionary *info = [center userInfo];
NSNumber *number=[info objectForKey:@"one"];
NSLog(@"%@",number);
NSLog(@"测试成功");
}
通知:
NSDictionary *p = [[NSDictionary alloc] initWithObjects:@[@1,@2,@3] forKeys:@[@"one",@"two",@"three"]];
[[NSNotificationCenter defaultCenter] postNotificationName:@"zhibintest" object:self userInfo:p];