谷歌地图sdk ios 7 mylocationbutton消失 [英] google map sdk ios 7 mylocationbutton disappear

查看:330
本文介绍了谷歌地图sdk ios 7 mylocationbutton消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的iOS应用程序中使用我的Google地图ios sdk,并设置了 mylocationbutton = yes ;

这是完整的代码


GMSCameraPosition * camera = [GMSCameraPosition
cameraWithLatitude:-33.86
longitude:151.20
zoom: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

解决方案

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

  self.edgesForExtendedLayout = UIRectEdgeNone; 

这对我有用,但你也可以尝试像从mapView_ objects儿童获得按钮,将其上的x和y属性更改为可见区域内。



希望这有助于。


i'm using my google map ios sdk in my ios app and i set mylocationbutton = yes;

here is the complete code

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86 longitude:151.20 zoom:6]; mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera]; mapView_.myLocationEnabled = YES; self.view = mapView_;

mapView_.delegate = self;

mapView_.settings.myLocationButton = YES;

mapView_.settings.compassButton = YES;

it is running well in ios 6 or earlier level which the button appear on the right down corner.

but i found that the button disappears if the app in running on ios 7 device or simulator

i already change different deployment level from 5 to 7

解决方案

This is because in iOS 7 the views extend behind the bars, (i.e. UINavigationBar and UITabBar) so the compass and myLocation buttons end up behind those bars. One way to get around this is to set the edgesForExtendedLayout property to UIRectEdgeNone so that the edges stop at the bars.

self.edgesForExtendedLayout = UIRectEdgeNone;

This worked for me, but you could also try something like getting the buttons from the mapView_ objects children and changing the x and y properties on it to be inside the visible area.

Hopefully this helps.

这篇关于谷歌地图sdk ios 7 mylocationbutton消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆