6

My code:

var camera = GMSCameraPosition.cameraWithLatitude(currentLocation.latitude, longitude: currentLocation.longitude, zoom: 12) 
//latitude, longitude like :31.230416 and 121.473701.
let map = GMSMapView(frame: CGRectZero)
map.delegate = self
map.camera = camera
self.view = map

It work fine! like this:

enter image description here

But when I create new View: @IBOutlet weak var mapView: UIView!

Then change this line: self.view = map to self.mapView = map

It not work for me, I get a blank view.

rome 웃
  • 1,821
  • 3
  • 15
  • 33

1 Answers1

11

I fixed it by go to my view (view display map), then change class my view to GMSMapView. enter image description here

rome 웃
  • 1,821
  • 3
  • 15
  • 33