ios - Google Logo 隐藏在底部任务栏后面

标签 ios google-maps sdk google-maps-sdk-ios

在我的应用程序中,我使用的是 Google Maps SDK。
我的应用程序中有一张全屏 map 。
问题是谷歌标志从导航选项卡后面的屏幕底部被切断。 我不知道要更改什么以调整 map 大小以在屏幕上显示 Logo 。 我会附上问题的屏幕截图,但我没有足够的声誉。

由于我对 Obj-C 和 Xcode 编程还很陌生,所以我可能忘记发布 map 实现所必需的部分代码。

- (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];      
}

我设法将它强行调高了一点,但这样做的方式真的很丑陋。

    _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];

最佳答案

另一种选择是在使 View 保持相同大小的同时填充控件:

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

使用 SDK 1.8 进行测试,它移动了 Google Logo 和各种控件。

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.

关于ios - Google Logo 隐藏在底部任务栏后面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23905246/

相关文章:

ios - iOS 中的单行 XML 解析器

javascript - 无法使变量成为 map 中心

iphone - 当 iPhone 应用程序到达一天中的特定时间时,我如何收到通知?

ios - 通过按钮从不同的 View 更新标签

ios - 除非我指定正确的 CGRect,否则 UIView 上的按钮没有响应

ios - 带有自定义对象的 NSKeyedUnarchiver

iphone - <错误> : CGContextSaveGState: invalid context 0x0 Error

javascript - 如何在弹出窗口中打开 Google map 链接?

google-maps - 使用 Google Maps Javascript API V3 反向地理编码检索邮政编码

iphone - 在 iOS 上使用 FB SDK 将视频上传到 Facebook,会删除方向。我如何解决它?