今天遇见一行代码实现打开一个网页,比起印象里的UIWebView控件实现简单很多,很容易使用而且,经过真机测试却是很方便使用,在网上又搜索了一点相关资料:
代码段:[[UIApplication sharedApplication] openURL:url];
其中系统的url有:
1.Map http://maps.google.com/maps?q=Shanghai
2.Email mailto://myname@google.com
3.Tel tel://10086
4.Msg sms://10086
- (IBAction)openMaps {
//打开地图
NSString*addressText = @"beijing";
//@"1Infinite Loop, Cupertino, CA 95014";
addressText =[addressText stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSString *urlText = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@",addressText];
NSLog(@"urlText=============== %@", urlText);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];
}
- (IBAction)openEmail {
//打开mail // Fire off an email to apple support
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"mailto://devprograms@apple.com"]];
}
- (IBAction)openPhone {
//拨打电话
// Call Google 411
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://10086"]];
}
- (IBAction)openSms {
//打开短信
// Text toGoogle SMS
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://10086"]];
}
-(IBAction)openBrowser {
//打开浏览器
// Lanuch any iPhone developers fav site
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://blog.csdn.net/duxinfeng2010"]];
}
参考 http://www.cocoachina.com/bbs/read.php?tid=73570&page=3
分享到:
相关推荐
ios源码之打开其他应用openURL.rar
使用openURL调用系统邮箱客户端是我们在IOS3.0以下实现发邮件功能的主要手段。我们可以通过设置url里的相关参数来指定邮件的内容,不过其缺点很明显,这样的过程会导致程序暂时退出。下面是使用openURL来发邮件的一...
一、程序外调用系统发短信 这个方法其实很简单,直接调用openURL即可: NSURL *url = [NSURL URLWithString:@sms://15888888888]; [[UIApplication sharedApplication]openURL:url]; 二、程序内调用系统发短信 ...
1、调用 自带mail [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@... iOS应用内拨打电话结束后返回应用 一般在应用中拨打电话的方式是: [[UIApplication sharedApplication] openUR
react-native-sms, 支持iOS和Android的短信发送方 react-native-sms用户定义的SendSMS使用这个 rn 组件发送带有回调 (completed/cancelled/error). iOS和Android的短信。目前,只支持用户发送短信。 this react-na
最近在开发中遇到了一些问题,发现iOS 10拨打系统电话发现弹出框会延迟2s左右出现,很不爽,研究了一下,发现是openURL在iOS 10及其之后会阻塞主线程 所以,拨打电话前,做个判断,下面话不多说了,来一起看看详细...
inet控件中使用需要调用msinet.ocx 1、inet控件中openurl读出网页源码不完整的问题。这是因为msinet.ocx版本没有更新到最新,最新版本为6.1.97.82,约130K,大部分机器版本都是6.0.81.69,约112K。32位系统中将新版...
iOS App xcode模拟器的BUG.zip 用xcode开发苹果app,经常会遇到这个BUG,在iphone真机上就没事,在iphone模拟器上就不行 canOpenURL failed for URL
OpenURL for Windows Mobile
支持用不同浏览器打开url支持用不同浏览器打开url
openURL.zipIOS应用例子源码下载openURL.zipIOS应用例子源码下载 1.适合学生学习研究参考 2.适合个人学习研究参考 3.适合公司开发项目技术参考
iOS 10之后苹果对于用户隐私方面要求非常严格,曾经帮朋友发布纯H5的APP,由于使用第三方而未加隐私权限都不让提交App Store。这边就是给大家列举下苹果对于最为常见的隐私以及平时我们开发是会用到的openUrl这方法...
URL Scheme 应用示例-双向openURL实现文档
本资源包含了31天iOS入门源码,是学习iOS的最佳入门资料。 Day 01: Minutes to Midnight Day 02: Bonfire Day 03: openURL Day 04: What is my IP? Day 05: Count Me In Day 06: Reaction Time Day 07: Speed ...
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { //如果极简 SDK 不可用,会跳转支付宝钱包进行支付,需要...
cd OpenURL/OpenURL.tableplusplugin npm install npm run build open . 如何使用 打开一个连接。 打开桌子。 单击一个单元格。 单击菜单中的Go to URL 。 执照 OpenURL是根据MIT许可发布的。 有关详细信息,请...
OpenUrl SetMediaHeader SaveUserPrinterSertup LoadUserPrinterSetup PrintBatchWebPage PrintWebPage PrintSetupWebPage PrintView PrintSetup PrintStatus SetPrintObjects SetPrintBackground 支持打印方案保存...
代码集成支持Block、Delegate: //设置启动页广告图片的url NSString *imgUrlString =@""; //初始化启动页广告(初始化后,自动添加... [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; };