openURL的使用方法
openURL的使用方法
openURL的使用方法:
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:appString]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:appString]];
其中系统的appString有:
- Map http://maps.google.com/maps?q=Shanghai
- Email mailto://myname@google.com
- Tel tel://10086
- Msg sms://10086
Map http://maps.google.com/maps?q=Shanghai
Email mailto://myname@google.com
Tel tel://10086
Msg sms://10086
除此之外,还可以自己定义URL,方法如下:
- 打开info.plist,添加一项URL types
- 展开URL types,再展开Item1,将Item1下的URL identifier修改为URL Scheme
- 展开URL Scheme,将Item1的内容修改为myapp
- 其他程序可通过myapp://访问此自定义URL
打 开info.plist,添加一项URL types 展开URL types,再展开Item1,将Item1下的URL identifier修改为URL Scheme 展开URL Scheme,将Item1的内容修改为myapp 其他程序可通过myapp://访问此自定义URL
参考资料:
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo}
http://iphonedevelopertips.com/cocoa/launching-other-apps-within-an-iphone-application.html
openURL能帮助你运行Maps,SMS,Browser,Phone甚至其他的应用程序。这是Iphone开发中我经常需要用到的一段代码,它仅仅只有一行而已。
- - (IBAction)openMaps {
- //打开地图
- NSString *addressText = @"beijing";//@"1 Infinite 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)openMaps {
//打开地图
NSString *addressText = @"beijing";
//@"1 Infinite 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)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://8004664411"]];
- }
- (IBAction)openPhone {
//拨打电话
// Call Google 411
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8004664411"]];
}
- - (IBAction)openSms {
- //打开短信
- // Text to Google SMS
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://466453"]];
- }
- (IBAction)openSms {
//打开短信
// Text to Google SMS
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://466453"]];
}
- -(IBAction)openBrowser {
- //打开浏览器
- // Lanuch any iPhone developers fav site
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunesconnect.apple.com"]];
- }
-(IBAction)openBrowser {
//打开浏览器
// Lanuch any iPhone developers fav site
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunesconnect.apple.com"]];
}
openURL的使用方法的更多相关文章
- openURL的使用方法:
openURL的使用方法: view plaincopy toclipboardprint? [[UIApplication sharedApplication] openURL:[NS ...
- iOS9 application:application openURL: sourceApplication: annotation: 方法不执行
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url NS_DEPRECATED_IOS(2_0, 9 ...
- (转)openURL的使用方法
view plaincopy to clipboardprint? [[UIApplication sharedApplication] openURL:[NSURL URLWithString:ap ...
- app跳转openURL,兼容方法
- (void)openScheme:(NSString *)scheme { UIApplication *application = [UIApplication sharedApplicat ...
- Unity iOS打开AppStore评星页面,浅谈Application.OpenURL()方法。
http://fairwoodgame.com/blog/?p=38 Unity iOS打开AppStore评星页面,浅谈Application.OpenURL()方法. Posted in Uni ...
- (译)openURL 在 iOS10中已弃用
翻译自:openURL Deprecated in iOS10 译者:Haley_Wong 苹果在iOS 2 推出了 openURL:方法 作为一种打开外部链接的方式.而与之相关的方法 canOpen ...
- OpenURL的一些用法
openURL的使用方法: view plaincopy to clipboardprint? [[UIApplication sharedApplication] openURL:[NSURL UR ...
- easyUI 如何不跳转页面,只是加载替换center部分内容
以前做的一个故障报修系统,前端框架使用easyUI框架,layout布局,center使用datagrid .点击左边树形菜单时时页面跳转,想要知道如何点击菜单时不进行页面跳转,而是只对center模 ...
- iOS开发200个tips总结(一)
tip 1 : 给UIImage添加毛玻璃效果 func blurImage(value:NSNumber) -> UIImage { let context = CIContext(opti ...
随机推荐
- JSch - Java实现的SFTP(文件上传详解篇)(转)
JSch是Java Secure Channel的缩写.JSch是一个SSH2的纯Java实现.它允许你连接到一个SSH服务器,并且可以使用端口转发,X11转发,文件传输等,当然你也可以集成它的功能到 ...
- Supporting Multiple Screens 翻译 支持各种屏幕(上)
Supporting Multiple Screens 支持各种各样的屏幕尺寸.屏幕密度 Android runs on a variety of devices that offer differe ...
- solrnet - document
Overview and basic usage Mapping Initialization Create/Update/Delete Querying Faceting Highlightin ...
- simulink下直接代码生成
连接好DSP,打开Matlab,首先必须要更改环境,要不不能编译通过 输入C2000lib,打开库, 在C2833X DSP Chip Support中添加外设,然后在C2000 Target Pre ...
- HDOJ1021题 Fibonacci Again 应用求模公式
Problem Description There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) ...
- [git] git 分支管理和工作流程
分支管理 列举本地分支.下面的 * 是 HEAD 所指向的分支,标识当前工作目录所用的分支.其他分支隐藏在 git 仓库中,通过 git checkout 命令才能访问和修改. $ git branc ...
- socket programming Max size of tcp/ip socket Buffer?
TCP data is buffered at both sender and receiver. The size of the receiver's socket receive buffer d ...
- Java Executor 框架学习总结
大多数并发都是通过任务执行的方式来实现的.一般有两种方式执行任务:串行和并行. class SingleThreadWebServer { public static void main(String ...
- Android四大组件之ContentProvider(二)读取设备上的图片、音频和视频
Android系统提供了MediaScanner,MediaProvider,MediaStore等接口,通过Content Provider的方式提供给用户.当设备开机或者有SD卡插拔等事件发生时, ...
- winform 导出TXT 分类: WinForm 2014-05-15 15:29 128人阅读 评论(0) 收藏
截图: 代码实现:(导出txt按钮事件) using System.IO; using System.Data.OleDb; private void btnOutTxt_Click(object s ...