在Swift中的View上显示GoogleMaps?

rom*_*e 웃 6 google-maps ios swift

我的代码:

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
Run Code Online (Sandbox Code Playgroud)

它工作正常!像这样:

在此输入图像描述

但是当我创建新视图时: @IBOutlet weak var mapView: UIView!

然后改变这一行:self.view = maptoself.mapView = map

它不适合我,我得到一个空白的视图.

rom*_*e 웃 11

我通过转到我的视图(查看显示地图)修复它,然后将我的视图更改为GMSMapView. 在此输入图像描述