国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

postNotificationName消息傳遞詳解

2019-11-14 17:58:14
字體:
來源:轉載
供稿:網友
 
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 的參數。

 


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 海安县| 包头市| 河津市| 莲花县| 大余县| 锡林郭勒盟| 正宁县| 大丰市| 安新县| 周至县| 栖霞市| 河北省| 永济市| 滕州市| 延津县| 西乌| 台州市| 英吉沙县| 盘山县| 桑植县| 靖远县| 灵山县| 蒲城县| 冷水江市| 建宁县| 渑池县| 体育| 恩施市| 东港市| 仁化县| 德昌县| 星子县| 普宁市| 丰顺县| 天峨县| 沛县| 绥江县| 白河县| 淄博市| 多伦县| 申扎县|