根据指定经纬度创建地图并且定位
2012-12-12 22:22
330 查看
//地图边框的实现
UIView *view =[[UIView alloc]initWithFrame:CGRectMake(10, 120, 300, 240)];
view.layer.cornerRadius =12;
view.backgroundColor=[UIColor whiteColor];
view.layer.masksToBounds=YES;
[self.view addSubview:view];
[view release];
//添加地图
map = [[[MKMapView alloc] initWithFrame:view.bounds] autorelease];
map.showsUserLocation =YES;
map.mapType=MKMapTypeStandard;//地图样式
[view addSubview:map];
//将传过来的经纬度转换成doubel
double fourth = [_fourth doubleValue];
double fourth2 = [_fourth2 doubleValue];
//设置定为器 和指定经纬度
CLLocationCoordinate2D coords = CLLocationCoordinate2DMake(fourth,fourth2);
//缩放级别
float zoomLevel =0.02;
MKCoordinateRegion region=MKCoordinateRegionMake(coords, MKCoordinateSpanMake(zoomLevel,zoomLevel));
[map setRegion:[map regionThatFits:region]animated:YES];本文出自 “yangjun” 博客,谢绝转载!
UIView *view =[[UIView alloc]initWithFrame:CGRectMake(10, 120, 300, 240)];
view.layer.cornerRadius =12;
view.backgroundColor=[UIColor whiteColor];
view.layer.masksToBounds=YES;
[self.view addSubview:view];
[view release];
//添加地图
map = [[[MKMapView alloc] initWithFrame:view.bounds] autorelease];
map.showsUserLocation =YES;
map.mapType=MKMapTypeStandard;//地图样式
[view addSubview:map];
//将传过来的经纬度转换成doubel
double fourth = [_fourth doubleValue];
double fourth2 = [_fourth2 doubleValue];
//设置定为器 和指定经纬度
CLLocationCoordinate2D coords = CLLocationCoordinate2DMake(fourth,fourth2);
//缩放级别
float zoomLevel =0.02;
MKCoordinateRegion region=MKCoordinateRegionMake(coords, MKCoordinateSpanMake(zoomLevel,zoomLevel));
[map setRegion:[map regionThatFits:region]animated:YES];本文出自 “yangjun” 博客,谢绝转载!
相关文章推荐
- iOS中根据已有经纬度定位并显示在地图上
- 根据经纬度在地图上定位
- 根据指定的经纬度显示地图位置
- iOS中根据已有经纬度定位并显示在地图上
- titanium开发教程-05-01创建一个地图并且设置坐标
- 百度地图_根据地图上标记位置获取街道信息,以及经纬度信息
- iOS 根据两个或多个经纬度在地图画线
- iOS根据该地经纬度在地图上显示该地的大头针
- 高德地图生成静态图片,显示指定经纬度的地图
- Windows 8 地理位置定位 4.根据经纬度计算地面两点间的距离
- Jquery根据关键字快速定位GridView指定行,用于数据快速检索
- java google 地图 根据经纬度 获取地址
- CLLocationManager定位经纬度,MKReverseGeocoder地址解析, MKMapView 地图显示 iphone
- JAVASCRIPT使用百度定位根据经纬度返回城市名称
- 根据经纬度坐标定位用户所在城市
- Bing 地图根据已知点经纬度 距离 方位 计算另一点的经纬度的方法 转载自Bing官网
- 移动机器人定位与地图创建(SLAM)方法
- iOS定位服务与地图开发(1)---获取经纬度
- 百度地图之地图显示和定位,获取定位的经纬度
- oracle 创建一个用户,并且设定只能访问指定的对象