码迷,mamicode.com
首页 > 移动开发 > 详细

iOS通知传值

时间:2016-09-13 20:45:17      阅读:267      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!