读书人

【IPhone开发】NSNotificationCenter观

发布时间: 2012-09-11 10:49:03 作者: rapoo

【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];             }




读书人网 >Iphone

热点推荐