【问题标题】:Xcode Mapkit zoom to current locationXcode Mapkit 缩放到当前位置
【发布时间】:2013-01-22 11:15:01
【问题描述】:

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

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

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

谢谢!!

【问题讨论】:

    标签: xcode location


    【解决方案1】:

    这可能对你有帮助:

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

    【讨论】:

      猜你喜欢
      • 2017-05-02
      • 2011-10-24
      • 2012-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-06
      • 2014-04-03
      • 2013-08-27
      相关资源
      最近更新 更多