iOS通知传值


   NSMutableDictionary *params = [NSMutableDictionary dictionary];

   params[@"loginName"] = @"abc";

   params[@"password"] = @"123456";

//创建通知
    NSNotification *notification =[NSNotification notificationWithName:@"tongzhi" object:nil userInfo:params];
//通过通知中心发送通知
   [[NSNotificationCenter defaultCenter] postNotification:notification];

 

 //注册通知
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tongzhi:) name:@"tongzhi" object:nil];

- (void)tongzhi:(NSNotification *)text{
    NSLog(@"%@",text.userInfo[@"mobile"]);
    NSLog(@"-----接收到通知------"); 
}

 

posted @ 2016-09-13 19:08  低头捡到蛋  阅读(169)  评论(0编辑  收藏  举报