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(@"-----接收到通知------"); 
}
原文地址:https://www.cnblogs.com/xsphehe/p/5869493.html