ios学习--openURL的使用方法
来源:互联网 发布:centos防火墙添加端口 编辑:程序博客网 时间:2024/05/16 12:05
openURL的使用方法:
view plaincopy toclipboardprint?
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:appString]];
其中系统的appString有:
view plaincopy toclipboardprint?
1.Map http://maps.google.com/maps?q=Shanghai
2.Email mailto://myname@google.com
3.Tel tel://10086
4.Msg sms://10086
openURL能帮助你运行Maps,SMS,Browser,Phone甚至其他的应用程序。这是Iphone开发中我经常需要用到的一段代码,它仅仅只有一行而已。
- (IBAction)openMaps {
//打开地图
NSString*addressText = @"beijing";
//@"1Infinite Loop, Cupertino, CA 95014";
addressText =[addressTextstringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSString*urlText = [NSStringstringWithFormat:@"http://maps.google.com/maps?q=%@",addressText];
NSLog(@"urlText=============== %@", urlText);
[[UIApplicationsharedApplication] 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 {
//拨打电话
// CallGoogle 411
[[UIApplication sharedApplication] openURL:[NSURLURLWithString:@"tel://8004664411"]];
}
- (IBAction)openSms {
//打开短信
// Text toGoogle SMS
[[UIApplication sharedApplication] openURL:[NSURLURLWithString:@"sms://466453"]];
}
-(IBAction)openBrowser {
//打开浏览器
// Lanuch any iPhone developers fav site
[[UIApplication sharedApplication] openURL:[NSURLURLWithString:@"http://itunesconnect.apple.com"]];
}
iphone程序内调用谷歌地图
使用CLLocationManager类,MKMapView。并且实现<MKMapViewDelegate,CLLocationManagerDelegate>
//初始化CLLocationManager,CLLocationManager获得当前地理坐标
locmanager=[[CLLocationManager alloc]init];
[locmanager setDelegate:self];
//设置精确度
[locmanager setDesiredAccuracy:kCLLocationAccuracyBest];
[locmanagerstartUpdatingLocation];
执行完以后,会自动调用代理方法:
view plaincopy toclipboardprint?
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:appString]];
其中系统的appString有:
view plaincopy toclipboardprint?
1.Map http://maps.google.com/maps?q=Shanghai
2.Email mailto://myname@google.com
3.Tel tel://10086
4.Msg sms://10086
openURL能帮助你运行Maps,SMS,Browser,Phone甚至其他的应用程序。这是Iphone开发中我经常需要用到的一段代码,它仅仅只有一行而已。
- (IBAction)openMaps {
//打开地图
NSString*addressText = @"beijing";
//@"1Infinite Loop, Cupertino, CA 95014";
addressText =[addressTextstringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSString*urlText = [NSStringstringWithFormat:@"http://maps.google.com/maps?q=%@",addressText];
NSLog(@"urlText=============== %@", urlText);
[[UIApplicationsharedApplication] 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 {
//拨打电话
// CallGoogle 411
[[UIApplication sharedApplication] openURL:[NSURLURLWithString:@"tel://8004664411"]];
}
- (IBAction)openSms {
//打开短信
// Text toGoogle SMS
[[UIApplication sharedApplication] openURL:[NSURLURLWithString:@"sms://466453"]];
}
-(IBAction)openBrowser {
//打开浏览器
// Lanuch any iPhone developers fav site
[[UIApplication sharedApplication] openURL:[NSURLURLWithString:@"http://itunesconnect.apple.com"]];
}
iphone程序内调用谷歌地图
使用CLLocationManager类,MKMapView。并且实现<MKMapViewDelegate,CLLocationManagerDelegate>
//初始化CLLocationManager,CLLocationManager获得当前地理坐标
locmanager=[[CLLocationManager alloc]init];
[locmanager setDelegate:self];
//设置精确度
[locmanager setDesiredAccuracy:kCLLocationAccuracyBest];
[locmanagerstartUpdatingLocation];
执行完以后,会自动调用代理方法:
- ios学习--openURL的使用方法
- ios学习--openURL的使用方法
- ios学习--openURL的使用方法
- ios学习--openURL的使用方法
- ios学习--openURL的使用方法
- iOS开发>>>openURL的使用方法
- OpenURL的使用方法
- openURL的使用方法:
- openURL的使用方法
- openURL的使用方法
- openURL的使用方法:
- OpenURL 使用方法
- IOS中openURL的使用
- iOS中OpenURL的使用
- openURL(注意backgroundTask 的学习)
- openURL ios
- iOS:openURL
- IOS openURL 运行其他的应用程序
- 高效程序员的45个习惯
- Tomcat目录下的各个文件夹的作用
- html常用标签及属性(表格/table,td)
- Android2.3 Launcher源码在eclipse中怎么编译--步骤(转)
- 计算机视觉库OpenCV在Linux平台上的移植
- ios学习--openURL的使用方法
- 教你用软件制作自己的系统主题包
- GCC编译优化指南
- 谷歌如何测试软件 —— 第三部分
- MFC使用ADO访问MSSQL2005数据库
- Wince5.0下如何将Public和Private下的代码移植到BSP下
- 美女,僧人,腐尸,菩萨美女
- 下载网站快捷方式
- Source Insight中查看文件显示全路径