Search code examples
iosgoogle-mapssdkgoogle-maps-sdk-ios

Google Logo hides behind bottom taskbar


In my application I am using Google Maps SDK.
I have a full screen map in my application.
The problem is that Google logo is cut off from bottom part of the screen behind navigation tab. I don't know what to change anymore to resize map to show logo on a screen. I would attach screenshot of the problem but I don't have enough reputation.

As I am fairly new with Obj-C and programming in Xcode, I may have forgotten to post some part of code essential for maps implementation.

- (void)viewDidLoad 
{
    [super viewDidLoad];
    _firstLocationUpdate = NO;
    _errorView.layer.cornerRadius = 5;
    _errorView.clipsToBounds = YES;

    GMSCameraPosition *camera = [GMSCameraPosition cameraWithTarget:_mapView.myLocation.coordinate zoom:14];

    _mapView = [GMSMapView mapWithFrame:self.view.frame camera:camera];
    _mapView.delegate = self;

    [self.view addSubview:_mapView];
    [self.view sendSubviewToBack:_mapView];      
}

I managed to force it a little bit up, but this is really ugly way of doing it.

    _mapView = [GMSMapView
               mapWithFrame: CGRectMake(
                                        0, -50,
                                        self.view.frame.size.width, self.view.frame.size.height)
               camera: camera];


  [self.view addSubview:_mapView];
  [self.view sendSubviewToBack:_mapView];

Solution

  • Another option would be to pad the controls while leaving the view the same size:

    // top, left, bottom, right
    _mapView.padding = UIEdgeInsetsMake(0.0, 0.0, 50.0, 0.0);
    

    Testing with SDK 1.8, it moves the Google logo and the various controls.

    Google SDK documentation for the padding property:

    Controls the 'visible' region of the view. By applying padding an area arround the edge of the view can be created which will contain map data but will not contain UI controls.

    If the padding is not balanced, the visual center of the view will move as appropriate. Padding will also affect the projection property so the visible region will not include the padding area. GMSCameraUpdate fitToBounds will ensure that both this padding and any padding requested will be taken into account.

    This property may be animated within a UIView-based animation block.