2012-01-03 96 views
1

我成功地从我的tutorial.wat之一获取当前位置的经度和纬度,我想要将它整合到我的mapview中,以便id获得一个蓝色指示器在我的mapview.i中了解添加注释时的mapview基础知识,但是如何整合我的当前位置.id如果你们给我提供了一个例子,那么这会非常有用。下面是代码。如何在mapview中显示我目前的位置(GPS)

- (void)locationUpdate:(CLLocation *)location { 
speedLabel.text = [NSString stringWithFormat:@"SPEED: %f", [location speed]]; 
latitudeLabel.text = [NSString stringWithFormat:@"LATITUDE: %f", location.coordinate.latitude]; 
longitudeLabel.text = [NSString stringWithFormat:@"LONGITUDE: %f", location.coordinate.longitude]; 
altitudeLabel.text = [NSString stringWithFormat:@"ALTITUDE: %f", [location altitude]]; 
NSLog(@"will dis :%d",location.coordinate.latitude); 

}

回答

2

获取表示在地图上的用户当前位置的蓝指示剂是非常简单的。刚上包含的MKMapView您的视图控制器设置

[self.mapView setShowsUserLocation:YES];

此外,在您当前位置附近设置mapView的区域很有用。欲了解更多信息,请查询this Apple's example

+0

感谢Michal dat worked.i有两个查询1)我想要一个对话框,是否允许我的应用程序使用currnet位置2)gps区域必须是100米 – kingston 2012-01-03 14:53:32

+0

1)它由系统自动显示。 2)玩弄我上面提到的示例代码(特别是检查方法gotoLocation)。有关如何计算跨度的提示,请参阅http://developer.apple.com/library/ios/#DOCUMENTATION/MapKit/Reference/MapKitDataTypesReference/Reference/reference.html#//apple_ref/doc/uid/TP40009734-CH1 -SW29 – 2012-01-03 14:58:29

+0

mkay ............ – kingston 2012-01-03 15:06:50