溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

App之間的跳轉(zhuǎn)

發(fā)布時(shí)間:2020-07-28 15:55:16 來源:網(wǎng)絡(luò) 閱讀:448 作者:卓行天下 欄目:移動(dòng)開發(fā)

App之間的跳轉(zhuǎn)


1,添加URL Types項(xiàng)

a,打開項(xiàng)目中.xcodeproj下的info目錄,增加一項(xiàng)URL Typs
 App之間的跳轉(zhuǎn)


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;
        }
            
    }
...
}


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI