google map sdk ios 7 mylocationbutton disappear

蹲街弑〆低调 提交于 2020-02-06 02:58:14

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/18908352/google-map-sdk-ios-7-mylocationbutton-disappear

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!