【问题标题】:google map sdk ios 7 mylocationbutton disappeargoogle map sdk ios 7 mylocationbutton消失
【发布时间】:2013-09-20 03:28:10
【问题描述】:

我在我的 ios 应用程序中使用我的 google map ios sdk,我设置了mylocationbutton = yes

这是完整的代码

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86 经度:151.20 缩放:6]; mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera]; mapView_.myLocationEnabled = YES; self.view = mapView_;

mapView_.delegate = self;

mapView_.settings.myLocationButton = YES;

mapView_.settings.compassButton = YES;

在ios 6或更早的版本中运行良好,按钮出现在右下角。

但我发现如果应用在 ios 7 设备或模拟器上运行,按钮会消失

我已经将不同的部署级别从 5 更改为 7

【问题讨论】:

    标签: google-maps ios7


    【解决方案1】:

    这是因为在 iOS 7 中,视图会延伸到栏的后面(即 UINavigationBar 和 UITabBar),因此指南针和 myLocation 按钮最终会位于这些栏的后面。解决此问题的一种方法是将 edgesForExtendedLayout 属性设置为 UIRectEdgeNone 以便边缘停止在条形处。

    self.edgesForExtendedLayout = UIRectEdgeNone;
    

    这对我有用,但您也可以尝试从 mapView_ 对象子对象中获取按钮并将其上的 x 和 y 属性更改为可见区域内。

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-30
      • 1970-01-01
      • 1970-01-01
      • 2013-02-17
      • 2015-12-26
      • 1970-01-01
      相关资源
      最近更新 更多