浏览 1907 次
锁定老帖子 主题:openURL
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2012-12-25
openURL的使用方法: - (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]; 执行完以后,会自动调用代理方法 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |