//发送通知页面方法
-(void)sendMessage {
NSString *servicerefresh = @"yes";
NSDictionary *dict =[[NSDictionary alloc] initWithObjectsAndKeys:servicerefresh,@"key",nil];
//创建通知
NSNotification *notification =[NSNotification notificationWithName:@"tongzhi" object:nil userInfo:dict];
//通过通知中心发送通知
[[NSNotificationCenter defaultCenter] postNotification:notification];
}
//接受通知页面方法
-(void)getnote{
//注册通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tongzhi:) name:@"tongzhi" object:nil];
}
- (void)tongzhi:(NSNotification *)text{
NSLog(@"99999999999999=9=%@",text.userInfo[@"key"]);
_value1 =text.userInfo[@"key"];
NSLog(@"_value1%@",_value1);
NSLog(@"-----接收到通知------");
}
// 第一界面移除监听的事件
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"tongzhi" object:nil];
}