星空网 > 软件开发 > 操作系统

postNotificationName 消息传递详解

 
1.定义消息创建的关联值 也就是找到方法的标志

NSString *const GameToIPhoneNotification = @"GameToIPhoneNotification"; GameToIPhoneNotification变量,@"GameToIPhoneNotification"这个值存于通知中心中,信息中心通过这个值来识别变量


1.注册一个消息中心

NSNotificationCenter *center = [NSNotificationCenter defaultCenter];

[center addObserver:self selector:@selector(onToIphone:) name:GameToIPhoneNotification object:nil];

 

-(void)onToIphone:(NSNotification*)notify :这个方法是接受到GameToIPhoneNotification这个通知所调用的方法

2.调用信息

 

NSNotificationCenter * center = [NSNotificationCenter defaultCenter];

[center postNotificationName:GameToIPhoneNotification object:nil userInfo:[NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:SMSRecommendNotification] , @"actcode",nil]];

 

[NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:SMSRecommendNotification] 这个是传递给-(void)onToIphone:(NSNotification*)notify 的参数。

 






原标题:postNotificationName 消息传递详解

关键词:post

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

Allegro推广工具:https://www.kjdsnews.com/a/778578.html
欧洲路向海运合约全线大涨,运费最高翻5倍!:https://www.kjdsnews.com/a/778579.html
2021年韩国在线交易额破1600亿美元,Shopee成印尼使用最广泛电商平台:https://www.kjdsnews.com/a/778580.html
全速派送,跨越全球,Equick跨境物流是怎么被全国卖家认可的?:https://www.kjdsnews.com/a/778585.html
Sendo平台怎么发货?附Sendo物流包装要求:https://www.kjdsnews.com/a/778586.html
2022年eBay Fulfillment仓配管理服务价格表:https://www.kjdsnews.com/a/778591.html
长治婚庆女司仪和主持人:https://www.vstour.cn/a/366176.html
北京丰台区水上乐园哪家好玩?:https://www.vstour.cn/a/366177.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流