Xcode Mapkit放大到当前位置

问题描述:

我有一个基于地图的iphone应用程序,当前显示用户位置和通过json拉出的注释。我正在尝试创建一个按钮,以便放大并集中用户的当前位置。我已经发现了下面的代码:Xcode Mapkit放大到当前位置

  • (IBAction为)showCurrentLocation { [MapView的setCenter:mapView.userLocation.coordinate动画:YES]; }

并明白,这可以帮助无论我在哪里粘贴此代码,我会得到错误。有没有人知道做这个工作的步骤/如果这是正确的方法?

谢谢!

这可能会帮助您:

- (IBAction)showCurrentLocation:(id)sender { 
self.mapview.showsUserLocation=YES; 
self.mapview.delegate = self; 
[self.mapview setUserTrackingMode:MKUserTrackingModeFollow animated:YES]; 
}