I am trying to load a Google Map into my application within a subview. When I initialize my GMSMapView in iOS, the current location is in the top left corner of the map instead of the center screen. This is true if I were to press the "My location" button as well.
This seems to be an issue when running on my phones but not on simulators. How do I get it so that it is set up correctly in the center?
I've tried rearranging code and loading the map differently. I think it might be due to Autolayout Constraints, as when I set mapView.translatesAutoresizingMaskIntoConstraints = true; then the location is in the center, but my view is messed up.
I currently have GMSMapView set up as the custom class of my view with auto layout constraints set up to resize it. I load up my GPS class and set the frame with this.
gpsVC = [[GPSViewController alloc] init];
gpsVC.view.frame=CGRectMake(0, CGRectGetMaxY(self.segmentTopView.frame), CGRectGetWidth(self.mainView.frame), CGRectGetHeight(self.mainView.frame)-CGRectGetHeight(self.topView.frame)-CGRectGetMaxY(self.segmentTopView.frame));
[self.segmentView addSubview:gpsVC.view];
And in my GPSViewController I set up the map camera as follows:
self.mapView.myLocationEnabled = YES;
GMSCameraPosition *camera=[GMSCameraPosition cameraWithLatitude:myLocation.coordinate.latitude longitude:myLocation.coordinate.longitude zoom:[mapDefaultZoomLevel floatValue]];
self.mapView.camera=camera;
Is anyone else experiencing this, and did you find any solution to this problem?
Edit: Here are some images (Links because I can't put in images yet)
https://imgur.com/FEMfwri
https://imgur.com/ySQio5b
https://imgur.com/9kijxbT