0

我有一个基于地图的 iphone 应用程序,该应用程序当前显示通过 json 提取的用户位置和注释。我正在尝试创建一个按钮,以便它缩放并以用户的当前位置为中心。我找到了以下代码:

  • (IBAction)showCurrentLocation { [mapView setCenter:mapView.userLocation.coordinate Animation:YES]; }

并了解这可以提供帮助,但是在我粘贴此代码的任何地方都会出现错误。有谁知道使这项工作的步骤/如果这是正确的方法?

谢谢!!

4

1 回答 1

1

这可能会帮助您:

- (IBAction)showCurrentLocation:(id)sender {
self.mapview.showsUserLocation=YES;
self.mapview.delegate = self;
[self.mapview setUserTrackingMode:MKUserTrackingModeFollow animated:YES];
}
于 2013-01-22T03:15:01.400 回答