App之間的跳轉(zhuǎn)
1,添加URL Types項(xiàng) a,打開項(xiàng)目中.xcodeproj下的info目錄,增加一項(xiàng)URL Typs
2,配置URL Scheme a,將URL identifie選項(xiàng)為com.KeYi.lsf
b,將URL Scheme選項(xiàng)的內(nèi)容修改為lsf - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { //抓取url if (!url) { return NO; }else { if ([[url host] isEqualToString:@"expert"]) { NSArray *codeArr = [[url query] componentsSeparatedByString:@"="]; if (codeArr.count >0) { if (self.window.rootViewController) { BaseTabBarController *tabBarController = (BaseTabBarController*)self.window.rootViewController; BaseNavigationController * bnc = (BaseNavigationController*)tabBarController.selectedViewController; HomeDetailController * hdc = [[HomeDetailController alloc]init]; hdc.expertInfoDic = @{@"expertUserId":codeArr[1]}; [bnc pushViewController:hdc animated:YES]; }else { } } return YES; }else if ([[url host] isEqualToString:@"topic"]) { NSArray *codeArray = [[url query] componentsSeparatedByString:@"&"]; NSArray *codeArr = [codeArray[0] componentsSeparatedByString:@"="]; NSArray *otherArr = [codeArray[1] componentsSeparatedByString:@"="]; if (codeArr.count > 0) { if (self.window.rootViewController) { BaseTabBarController *tabBarController = (BaseTabBarController*)self.window.rootViewController; BaseNavigationController * bnc = (BaseNavigationController*)tabBarController.selectedViewController; ExpertDetailController * edc = [[ExpertDetailController alloc]init]; edc.topicInfo = @{@"topicId":codeArr[1],@"expertUserId":otherArr[1]}; [bnc pushViewController:edc animated:YES]; }else { }
} return YES; } } ... }
|