I implemented the GMSMapView via the Googla Maps iOS SDK
the example code from Google suggests to declare the view more or less just dropping this method in your code
- (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_;
}
it automagically works, but the mapView happens to cover my navigationItem it's clear that the maps take its dimension at the initWithFram:CGRectZero but simply changing the parameter to a custom CGRect
CGRect square = CGRectMake(100, 100, 100, 100);
haven't worked for me, any other suggestion? i only need to display the map between the Nav Item and the Tab Bar (but the second doesn't happen to be covered)
The problem was that the mapView_ was being set as the whole view
self.view = mapView_;
calculating the correct dimension and adding it as a subview was the correct way to solve it
CGRect f = self.view.frame;
CGRect mapFrame = CGRectMake(f.origin.x, 44, f.size.width, f.size.height);
mapView_ = [GMSMapView mapWithFrame:mapFrame camera:camera];
[self.view addSubview:mapView_];