首页 > 移动平台 > 详细

iOS通知传值

时间:2016-09-13 20:42:21      阅读:260      评论:0      收藏:0      [点我收藏+]

   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(@"-----接收到通知------"); 
}

 

iOS通知传值

原文:http://www.cnblogs.com/xsphehe/p/5869493.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!