iOS實(shí)現(xiàn)app間跳轉(zhuǎn)功能
本文為大家分享了iOS實(shí)現(xiàn)app間跳轉(zhuǎn)功能的具體代碼,供大家參考,具體內(nèi)容如下
我們通過(guò)系統(tǒng)的openURL方法,可以從當(dāng)前的app跳轉(zhuǎn)到其他任意app去,包括系統(tǒng)自帶的、以及我們開(kāi)發(fā)的app。
本文模擬A app跳轉(zhuǎn)到 B app
A app代碼:
// A app
// ViewController.m
// 程序跳轉(zhuǎn)
//
// Created by hhg on 15/10/23.
// Copyright (c) 2015年 hhg. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
// 為我們的程序設(shè)置一個(gè)唯一的標(biāo)識(shí),那么其他軟件就可以使用openURL方法通過(guò)唯一標(biāo)識(shí)來(lái)打開(kāi)我們的程序
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"zapp:"]];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end
B app代碼:
// B app
// AppDelegate.m
// MyApp
//
// Created by hhg on 15/10/23.
// Copyright (c) 2015年 hhg. All rights reserved.
//
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return YES;
}
// 當(dāng)其他程序通過(guò)openURL打開(kāi)該程序的時(shí)候,會(huì)觸發(fā)這個(gè)方法
// URL ,就是其他程序打開(kāi)時(shí)候的URL
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"提示" message:@"跳轉(zhuǎn)成功!" delegate:nil cancelButtonTitle:@"確定" otherButtonTitles: nil];
[alertView show];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
}
- (void)applicationWillTerminate:(UIApplication *)application {
}
@end
B app 在info.plist 文件里面需要設(shè)置:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>CFBundleURLName</key>
<string></string>
<key>CFBundleURLSchemes</key>
<array>
<string>zapp</string>
</array>
</dict>
</array>
</plist>
如圖:

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- iOS整個(gè)APP實(shí)現(xiàn)灰色主題的示例代碼
- iOS APP實(shí)現(xiàn)微信H5支付示例總結(jié)
- iOS APP 多服務(wù)器環(huán)境分離的方法
- iOS App使用GCD導(dǎo)致的卡頓現(xiàn)象及解決方法
- iOS中在APP內(nèi)加入AppStore評(píng)分功能的實(shí)現(xiàn)方法
- iOS 11 AppIcon不顯示問(wèn)題小結(jié)
- iOS app 右滑返回操作的兩種方法
- iOS開(kāi)發(fā)中以application/json上傳文件實(shí)例詳解
- 淺談IOS如何對(duì)app進(jìn)行安全加固
相關(guān)文章
iOS移動(dòng)端軟鍵盤(pán)彈起空白和滾動(dòng)穿透問(wèn)題解決方案
這篇文章主要為大家介紹了iOS移動(dòng)端軟鍵盤(pán)彈起空白和滾動(dòng)穿透問(wèn)題解決方案,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-07-07
iOS用AutoLayout實(shí)現(xiàn)分頁(yè)滾動(dòng)功能
這篇文章主要給大家介紹了關(guān)于iOS用AutoLayout實(shí)現(xiàn)分頁(yè)滾動(dòng)功能的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)各位iOS開(kāi)發(fā)者們具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-06-06
iOS Touch ID指紋識(shí)別技術(shù)簡(jiǎn)介
這篇文章主要為大家詳細(xì)介紹了iOS Touch ID指紋識(shí)別技術(shù),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-04-04
解析iOS開(kāi)發(fā)中的FirstResponder第一響應(yīng)對(duì)象
這篇文章主要介紹了解析iOS開(kāi)發(fā)中的FirstResponder第一響應(yīng)對(duì)象,包括View的FirstResponder的釋放問(wèn)題,需要的朋友可以參考下2015-10-10
iOS AVCaptureSession實(shí)現(xiàn)視頻錄制功能
這篇文章主要為大家詳細(xì)介紹了iOS AVCaptureSession實(shí)現(xiàn)視頻錄制功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-05-05
iOS?實(shí)現(xiàn)類似抖音滾動(dòng)效果
這篇文章主要介紹了iOS?實(shí)現(xiàn)類似抖音滾動(dòng)效果,整體思路是我們將tableView 的contentinset設(shè)置為上面一個(gè)屏幕的高度,下面一個(gè)屏幕的高度,左右為0,這樣保證我們滾動(dòng)過(guò)去的時(shí)候2024-06-06
都是準(zhǔn)備好的內(nèi)容,需要的朋友可以參考下
iOS的UI開(kāi)發(fā)中UITabBarControlle的基本使用教程
這篇文章主要介紹了iOS的UI開(kāi)發(fā)中UITabBarControlle的基本使用教程,代碼基于傳統(tǒng)的Objective-C,需要的朋友可以參考下2015-12-12
Flutter?ScrollController滾動(dòng)監(jiān)聽(tīng)及控制示例詳解
這篇文章主要為大家介紹了Flutter?ScrollController滾動(dòng)監(jiān)聽(tīng)及控制示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-11-11

