0

This is the code in my viewDidLoad method. I am trying to prevent the Google Maps display from taking up the whole screen, but this code isn't working. I do not want to have to make two separate UIViews to display so is there an easier way to do this.

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
                                                        longitude:151.20
                                                             zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectMake(0.0, 0.0, 320.0, 400.0) camera:camera];
mapView_.myLocationEnabled = YES;
mapView_.delegate = self;
self.view = mapView_;
friedbunny
  • 2,421
  • 1
  • 23
  • 38

2 Answers2

1

In this way your mapView_ is filling your self.view. You should add the mapView as a subview of self.view by using :

[self.view addSubview: mapView_];

This way mapView_ will be a subview of your main view and will fill the frame you set to it.

BoilingLime
  • 2,207
  • 3
  • 22
  • 37
0

Why do you make self.view = mapView_;? You are practically replace self.view with mapview.

I believe you want to do this:-

[self.view addSubview:mapView_];

It is to add the mapView as the subview of self.view.

Ricky
  • 10,485
  • 6
  • 36
  • 49