You ended up with two GMSMapView
objects. The first one is the one that you created in Interface Builder and the second one is the one that you created programmatically with GMSCameraPosition
object in -viewDidLoad
method.
Seems like self.mapsView
references the view that you created in Interface Builder. When you assign a new GMSMapView
object with this line;
self.mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
you are actually losing the one that is created in Interface Builder, so your attempt to change the camera position is not working, because you're sending the message to the wrong object.
Also because of not adding the second GMSMapView
object to the view hierarhcy after you created it programmatically, in -viewDidLoad
method, you are not seeing it in your app. Although it sets its camera position correctly.
So you have two options;
1- Remove the mapView from interface builder (and unbind its outlet) and don't touch to the code but replace this line;
[self.mapView setCenter:CGPointMake(41.0109,28.998)];
with this line;
[self.view addSubview:self.mapView];
So that you'll have a map view created programmatically.
2- Don't touch to the storyboard, but remove this line;
self.mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
So you'll be creating a map view in Interface Builder, and configuring it.
Then it would be all fine.