首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

【IPhone开发】NSNotificationCenter观察者模式给主线程发送通报

2012-09-11 
【IPhone开发】NSNotificationCenter观察者模式给主线程发送通知添加观察者(无参数):NSString *appIndentier

【IPhone开发】NSNotificationCenter观察者模式给主线程发送通知

添加观察者(无参数):

NSString *appIndentier = @"kuainiao://";            NSRange range = NSMakeRange(0, [appIndentier length]);            NSLog(@"_startupURL is %@", _startupURL);            NSString *schema  = [_startupURL substringWithRange:range];            if([schema isEqualToString:appIndentier])            {                NSString *startupParam = [_startupURL substringFromIndex:[appIndentier length]];                NSLog(@"startupParam is %@",startupParam);                NSDictionary *info  = [NSDictionary dictionaryWithObject:startupParam forKey:@"url_result"];                [[NSNotificationCenter defaultCenter] postNotificationName:@"startup_from_url" object:nil userInfo:info];             }




热点排行