问题
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