在我的应用程序中,我使用的是 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/