Trying to display a simple Google map with a marker at location "position".
If mapview_ is shown in self.view(Default view of controller) instead of gmapsView (subview of self.view) of class GMSMapView then everything is working fine.
I have gone through some of the posts on SO but couldn't solve the issue. in Interface builder gmapsview class is set to GMSMapView.
Camera Postion setup
CLLocationCoordinate2D position = CLLocationCoordinate2DMake(
37.778376,
-122.409853);
CLLocation *currentLocation = [[CLLocation alloc] initWithLatitude:position.latitude longitude:position.longitude];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:position.coordinate.latitude
longitude:position.coordinate.longitude
zoom:13];
Map setup
mapView_ = [GMSMapView mapWithFrame:self.gmapsView.frame camera:camera];
mapView_.delegate = self;
self.gmapsView.camera = camera; //gmapsView is a view of class GMSMapView
CGRect rect = self.locationBlockView.frame;
self.gmapsView.delegate = self; //Added to check whether it works
self.gmapsView = mapView_;
Setting up Marker
GMSMarker *marker = [GMSMarker markerWithPosition:position]; //Adding Marker
marker.map = mapView_;
[mapView_ animateToLocation:position.coordinate];