启用后,Google地图罗盘按钮消失了

时间:2015-04-17 02:09:14

标签: ios google-maps swift

我在设置中打开了指南针按钮,但谷歌地图没有显示任何指南针按钮。导航栏是否覆盖罗盘按钮或实际上未启用?

enter image description here

swift code:

        camera = GMSCameraPosition.cameraWithLatitude(lat,longitude:long, zoom:17.5, bearing:0, viewingAngle:0)
        mapView = GMSMapView.mapWithFrame(CGRectZero, camera:camera)
        mapView.settings.myLocationButton = true
        mapView.settings.indoorPicker = true
        mapView.settings.compassButton = true
        mapView.indoorEnabled = true
        mapView.myLocationEnabled = true

1 个答案:

答案 0 :(得分:0)

指南针已被导航栏隐藏。

我在下面添加了代码来移动罗盘:

迅速:

        if let nav_height = self.navigationController?.navigationBar.frame.height
        {
           let status_height = UIApplication.sharedApplication().statusBarFrame.size.height

            mapView.padding = UIEdgeInsetsMake (nav_height+status_height,0,0,0);
        }