Google Maps iOS SDK move “My Location” button to bottom left hand corner

前端 未结 6 2121
南方客
南方客 2020-12-13 22:27

Using the Google Maps for iOS SDK, the \"My Location\" button is by default placed in the bottom right hand corner:

6条回答
  •  悲&欢浪女
    2020-12-13 22:57

    You can use the padding of the GMSMapView.

    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-37.81969
                                                            longitude:144.966085
                                                                 zoom:4];
    _mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
    
    _mapView.settings.myLocationButton = YES;
    _mapView.myLocationEnabled = YES;
    _mapView.padding = UIEdgeInsetsMake(0, 0, kOverlayHeight, 0);
    self.view = _mapView;
    

    SWIFT 3

    self._mapView.padding = UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 0)
    

提交回复
热议问题