大橙子网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

App之间的跳转

App之间的跳转

成都创新互联专注于新宾企业网站建设,响应式网站建设,商城网站制作。新宾网站建设公司,为新宾等地区提供建站服务。全流程定制设计,专业设计,全程项目跟踪,成都创新互联专业和态度为您提供的服务

1,添加URL Types项

a,打开项目中.xcodeproj下的info目录,增加一项URL Typs
 App之间的跳转

2,配置URL Scheme

a,将URL identifie选项为com.KeYi.lsf

b,将URL Scheme选项的内容修改为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;
        }
            
    }
...
}


标题名称:App之间的跳转
URL地址:http://dzwzjz.com/article/jdjspp.html
在线咨询
服务热线
服务热线:028-86922220
TOP