0

I want the google maps to be displayed in only half of the screen and there are other items to be displayed in other half of the screen. So, I have divided the iPhone screen into two UIViews, mapView and detailView. When i try to have the google map inside mapView, it gives blank screen. Whereas It display map in the whole screen when it is assigned to self.view as follow.

doesn't show in mapView

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
                                                        longitude:151.20
                                                             zoom:6];
GMSMapView *mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.mapView = mapView_; //Doesn't work

// 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_;
Chirag Shah
  • 3,034
  • 1
  • 30
  • 61
hexagon
  • 117
  • 1
  • 2
  • 13

1 Answers1

1

Change this line:

GMSMapView *mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];

To this:

   GMSMapView *mapView_ = [GMSMapView mapWithFrame:self.mapView.frame camera:camera];

That should fix your problem, if you've set up the separate view appropriately and should match to that views frame.

TomTom
  • 899
  • 8
  • 16