ios跳转到设置页面

发布时间 : 2020/11/21 13:22

1:打开Safari

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.baidu.com"]] ;

2:打电话

NSString *num = @ "110" ; //number为号码字符串 NSString *mobileNumber = [NSString stringWithFormat:@ "telprompt://%@" , num]; NSLog(@ "call phone %@;" , mobileNumber); [[UIApplication sharedApplication] openURL:[NSURL URLWithString:mobileNumber]] ;

提示:上面代码触发后,系统会提示用户是否真的要打电话, 电话结束后,会返回至应用程序,
假如将telprompt修改为:tel 后,点击可直接拨打电话, 但电话结束后,不会返回至应用程序

3:打开Mail

NSString *recipients = @ "mailto:ysy@flyrise.cn?subject=Hello from California!" ; NSString *body = @ "&body=It is raining in sunny California!" ; NSString *email = [NSString stringWithFormat:@ "%@%@" , recipients, body]; email = [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]] ;

4:打开Messages

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://800888"]] ;

5:打开App Store 某个应用的评价系统

NSLog (@ "%@" ,[[[SystemGlobalInfo defaultInstance] deviceInfo] applicationId]); NSString *str = [ NSString stringWithFormat: @ "itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%@" ,[[[SystemGlobalInfo defaultInstance] deviceInfo] applicationId]]; [[ UIApplication sharedApplication] openURL:[ NSURL URLWithString:str]];

6:打开App Store 中的某个应用 途中经过Safari

NSString *appID = @ "291586600" ; NSString *appUrl = [ NSString stringWithFormat:@ "http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=%@&mt=8" ,appID]; NSURL *appStoreUrl = [ NSURL URLWithString:appUrl]; [[ UIApplication sharedApplication] openURL:appStoreUrl];

7:打开App Store 中的某个应用 直接跳转

NSString *urlString = @ "http://itunes.apple.com/us/app/ye-wu-xie-zuo-ping-tai/id507704613?mt=8&uo=4" ; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]] ;

8:打开谷歌Maps进行搜索

NSString* searchQuery = @ "珠海" ; searchQuery = [searchQuery stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; NSString* urlString = [NSString stringWithFormat:@ "http://maps.google.com/maps?q=%@" , searchQuery]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]] ;

9:使用OpenUrl打开第三方应用程序

本文释权了打开的方法,很具体.. 地点如下:
http://blog.cnrainbird.com/index.php/2012/06/04/tong_guo_openurl_qi_dong_di_san_fang_app_bing_chuan_can_shu/
这里简单描述一下留意点,
1: A工程 需要打开 B 工程 那么B工程需要在plist文件中 进行UrlType的注册
2:在启动其他第三方应用程序之前,可以通过如下代码判定,应用程序是否已经安装在iPhone中.

NSURL *url = [ NSURL URLWithString:@ "AppMessageDemo:11" ]; if ([[ UIApplication sharedApplication] canOpenURL:url]) { [[ UIApplication sharedApplication] openURL:url]; } else { [ShareCode Msg:@ "没安装" ]; }

3: B工程被打开时,请使用如下委托处置打开的消息

-( BOOL )application:( UIApplication *)application openURL:( NSURL *)url sourceApplication:( NSString *)sourceApplication annotation:( id )annotation { NSLog (@ "%@" ,[url path]); NSLog (@ "%@" ,sourceApplication); NSLog (@ "%@" ,annotation); return NO ; }

下面这个委托,也就是微文中提到的委托,已经被苹果弃用

-( BOOL )application:( UIApplication *)application handleOpenURL:( NSURL *)url { NSLog (@ "123" ); return [WXApi handleOpenURL:url delegate: self ]; }

注: sourceApplication 表现 App plist文件中标明的 Bundle identifier
至于返回YES,还是返回NO,好像没有发生任何事情,待继续考据.

10:为应用设置首选项功能
创建:
这里写图片描述

公主连接ios跳转邮箱

// 联系人 : 石虎 QQ: 1224614774 昵称 : 嗡嘛呢叭咪哄 /** 留意:打电话、发短信、发邮箱 、跳转网站 功能(系统方法)---->要真机才有用果 */ 1.简单实现效果图:

2.实当代码:

@implementation ViewController

// 打电话

- ( IBAction )makePhone:( id )sender {

NSString *phoneNum = self . phoneTF . text ;

NSString *urlStr = [ NSString stringWithFormat : @"tel://%@" ,phoneNum];

NSURL *url = [ NSURL URLWithString :urlStr];

// 调用系统内置应用拨打电话

[[ UIApplication sharedApplication ] openURL :url];

}

// 发信息

- ( IBAction )sendMessage:( id )sender {

NSString *urlStr = [ NSString stringWithFormat : @"sms://%@" , self . phoneTF . text ];

[[ UIApplication sharedApplication ] openURL :[ NSURL URLWithString :urlStr]];

}

// 发邮箱

- ( IBAction )sendEmail:( id )sender {

NSString *mailStr = [ NSString stringWithFormat : @"mailto://%@" , self . emailTF . text ];

[[ UIApplication sharedApplication ] openURL :[ NSURL URLWithString :mailStr]];

}

// 进入网站

- ( IBAction )gotoURL:( id )sender {

NSURL *url = [ NSURL URLWithString : self . phoneTF . text ];

[[ UIApplication sharedApplication ] openURL :url];

} 谢谢!!!



关于本机 prefs:root=General&path=About 帮助功能 prefs:root=General&path=ACCESSIBILITY 飞行模式 prefs:root=AIRPLANE_MODE 主动锁定 prefs:root=General&path=AUTOLOCK 蓝牙 prefs:root=Bluetooth 日期与时间 prefs:root=General&path=DATE_AND_TIME FaceTime prefs:root=FACETIME 通用 prefs:root=General 键盘 prefs:root=General&path=Keyboard iCloud prefs:root=CASTLE iCloud存储空间 prefs:root=CASTLE&path=STORAGE_AND_BACKUP 语言与地域 prefs:root=General&path=INTERNATIONAL 定位服务 prefs:root=LOCATION_SERVICES 邮件、通讯录、日历 prefs:root=ACCOUNT_SETTINGS 音乐 prefs:root=MUSIC 音乐 prefs:root=MUSIC&path=EQ 音乐 prefs:root=MUSIC&path=VolumeLimit 备忘录 prefs:root=NOTES 通知 prefs:root=NOTIFICATIONS_ID 电话 prefs:root=Phone 照片与相机 prefs:root=Photos 描述文件 prefs:root=General&path=ManagedConfigurationList 还原 prefs:root=General&path=Reset 电话铃声 prefs:root=Sounds&path=Ringtone Safari prefs:root=Safari 声音 prefs:root=Sounds 软件更新 prefs:root=General&path=SOFTWARE_UPDATE_LINK App Store prefs:root=STORE Twitter prefs:root=TWITTER 视频 prefs:root=VIDEO VPN prefs:root=General&path=VPN 墙纸 prefs:root=Wallpaper WiFi prefs:root=WIFI 个人热门 prefs:root=INTERNET_TETHERING

本文网址: http://www.buildupknowledge.com/doc/20201021132820_1726_754098891/home