shareUIApplication openURL
来源:互联网 发布:下载mac软件的网站 编辑:程序博客网 时间:2024/05/16 11:04
iPhone的单任务模式为手机节省了资源,保障了程序的安全运行,但是这一做法也遭到很多人的反对,为很多应用带来了不便。如今,openURL这个方法为解决这一问题带来了希望,虽然离多任务模式还有差距,但毕竟给了大家一个实现更强大应用的可行方法。
openURL的使用方法:
1. http://iphonedevelopertips.com/c ... ne-application.html
2. http://iphonedevelopertips.com/c ... tom-url-scheme.html
openURL的使用方法:
CODE:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:appString]];
其中系统的appString有:CODE:
Map http://maps.google.com/maps?q=Shanghai
Email mailto://myname@google.com
Tel tel://10086
Msg sms://10086
除此之外,还可以自己定义URL,方法如下:CODE:
打开info.plist,添加一项URL types
展开URL types,再展开Item1,将Item1下的URL identifier修改为URL Scheme
展开URL Scheme,将Item1的内容修改为myapp
其他程序可通过myapp://访问此自定义URL
参考资料:1. http://iphonedevelopertips.com/c ... ne-application.html
2. http://iphonedevelopertips.com/c ... tom-url-scheme.html
openURL能帮助你运行Maps,SMS,Browser,Phone甚至其他的应用程序。这是Iphone开发中我经常需要用到的一段代码,它仅仅只有一行而已。
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8004664411"]];
这个程序通过基础的协议支持拨打电话的功能
译者附:
-(IBAction)openMaps {//打开地图
// Where is Apple on the map anyway?
NSString* addressText = @”1 Infinite Loop, Cupertino, CA 95014″;
// URL encode the spaces
addressText = [addressText stringByAddingPercentEscapesUsingEncoding: NSASCIIStringEncoding];
NSString* urlText = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", addressText];
// lets throw this text on the log so we can view the url in the event we have an issue
NSLog(urlText);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];
}
// Where is Apple on the map anyway?
NSString* addressText = @”1 Infinite Loop, Cupertino, CA 95014″;
// URL encode the spaces
addressText = [addressText stringByAddingPercentEscapesUsingEncoding: NSASCIIStringEncoding];
NSString* urlText = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", addressText];
// lets throw this text on the log so we can view the url in the event we have an issue
NSLog(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"]];
}
// 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"]];
}
// Call Google 411
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8004664411"]];
}
-(IBAction)openSms {//打开短信
// Text to Google SMS
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://466453"]];
}
// 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"]];
}
// Lanuch any iPhone developers fav site
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunesconnect.apple.com"]];
}
- shareUIApplication openURL
- openurl
- openURL
- openURL
- openURL:
- CInternetSession::OpenURL
- openURL ios
- openURL打电话
- OpenURL 使用方法
- handleOpenUrl && openUrl
- iOS:openURL
- iphone openURL用法
- [UIApplication sharedApplication] openURL
- OpenURL的使用方法
- openURL的使用方法:
- iOS中OpenURL相关
- openURL的使用方法
- [UIApplication sharedApplication] openURL 转载
- linux下的pdf阅读器
- 对J2SE中Runtime类得一些实践心得
- 用 JavaScript 清理干扰码
- 数据挖掘概念
- POJ-3672-Long Distance Racing-水题、%c输入要去除换行
- shareUIApplication openURL
- SCJP认证 第二章2.2继承、IS-A、HAS (2.1.0 继承)
- 捡起linux ---(2)第一次成功编译内核
- 平板三包新政深度解析
- 观张国荣的电影《霸王别姬》有感
- 缓存 SpringModules Cache ( spring 和 ehcache的整合 ) spring提供缓存bean方案
- linux开机启动
- spring核心技术总结
- posix消息队列