我通过 Googla Maps iOS SDK 实现了 GMSMapView
Google 的示例代码建议或多或少地声明视图,只需在代码中删除此方法
- (void)loadView {
// Create a GMSCameraPosition that tells the map to display the
// coordinate -33.86,151.20 at zoom level 6.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.view = mapView_;
// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = @"Sydney";
marker.snippet = @"Australia";
marker.map = mapView_;
}
它会自动工作,但是 mapView 恰好覆盖了我的 navigationItem 很明显,地图在 initWithFram:CGRectZero 处采用了它的尺寸,但只是将参数更改为自定义 CGRect
CGRect square = CGRectMake(100, 100, 100, 100);
对我没有用,还有其他建议吗?我只需要显示导航项和标签栏之间的地图(但第二个恰好没有被覆盖)