iphone web显示google地图
来源:互联网 发布:东华软件员工数量 编辑:程序博客网 时间:2024/06/01 09:50
iphone web显示google地图
在含有地图导航功能的 App 中显示乘车信息的话,可以通过 UIView 中显示 Google Map 信息的方法实现
实现的方法很简单:
首先创建一个view-base工程,声明UIView变量:
#import <UIKit/UIKit.h>
@interface iphone_mpaViewController : UIViewController {
IBOutlet UIWebView *myWenView;
}
@property (nonatomic,retain) UIWebView *myWenView;
@end
具体实现如下:
#import "iphone_mpaViewController.h"
@implementation iphone_mpaViewController
@synthesize myWenView;
- (void)viewDidLoad {
[super viewDidLoad];
//获取路线
NSMutableString *googleSearch = [NSMutableString stringWithFormat:@"http://ditu.google.cn/maps?f=d&source=s_d&saddr='北京'&daddr=31.186371,121.489885&hl=zh&t=m&dirflg=h"];
[myWenView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[googleSearch stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload {
self.myWenView=nil;
}
- (void)dealloc {
[super dealloc];
[self.myWenView release];
}
@end
打开xxxcontrol.xib拖一个webview到view上。点击files owner。按下command+2.
按住
myWenView右边的圆圈,拖动到uiwebview上。
按住 new refrencing outlets
右边的圆圈,拖动到uiwebview上。选delete
然后运行
通过上面的 URL 可以进行查询。其中 URL 参数的介绍可以查看 Google 地图 http 参数一文。
在开发中遇到一点问题,就是用地理位置设置成中文时,不能得到相应的地图,最后的解决方案是,把 URL 进行 utf8 encod,上面红色字体部分,把项目设置成中文即可。
源代码:http://easymorse-iphone.googlecode.com/svn/trunk/iphone.mpa/
- iphone web显示google地图
- iphone--通过 Google Map 显示地图和乘车信息的方法
- IE无法显示google地图
- google地图v3版的地图显示
- iphone中google地图基本应用试验
- iphone开发之Google地图实现…
- Google地图的web Services
- iphone开发 地图 长按显示大头针
- 调用iPhone地图显示指定的点
- Android用户定位Google Map显示地图
- 用js显示google地图总结
- 在Winform中显示Google地图
- 在google地图上显示一个层
- google显示当前地图的经纬度
- javascript google地图默认用中文显示
- 在Google地图中显示行政区边界
- Google地图上市级别分块显示
- VB6.0 google 地图显示GPS数据
- 解决火狐iframe自适应高度,兼容IE6、7、8
- Windows设置共享文件(待完善)
- Spring的proxool连接池(TOMCAT)
- suncity告诉你围棋的历史
- 循环线程
- iphone web显示google地图
- mysql查询不重复的记录总数distinct用法
- Java 简单Socket聊天系统模型(二)
- Eclipse 3.7 字体变小 解决办法
- 单向链表创建图解
- 编译移植appweb-3.3.2
- memory management 2
- JiaThis™“分享到”侧栏代码:
- [MTK]MTK栈大小及管理