I want to display google maps on a view that's then added to self.view
, rather than drawing the map directly on self.view
. Therefore, I created a view in storyboard and changed its class to GMSMapView
. I also created an outlet connection to that view called gmView
.
I am using the following code that does unfortunately not show the map:
let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: GMSCameraPosition.camera(withLatitude: 51.050657, longitude: 10.649514, zoom: 5.5))
gmView = mapView
Also, I tried adding the mapView
to self.view
as a subview, like this:
self.view.addSubview(mapView)
...and inserting it:
self.view.insertSubview(mapView, at: 0)
Note that I'm using Auto Layout if that changes anything.
None of these approaches seem to work for me.
Any ideas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…