import GoogleMaps
class GoogleMapView : GMSMapView {
}
手动在模拟器中编写代码使用GMSMapView,而不是在storyboard中使用GMSMapView
。
如果您在多个屏幕中使用地图,则需要为所有文件手动编写代码。
@IBOutlet weak var map_Views: UIView!
var map_View = GMSMapView()
override func viewDidLoad() {
super.viewDidLoad()
let camera = GMSCameraPosition.camera(withLatitude: Double(main_latitude)!, longitude: Double(main_longitude)!, zoom: 6.0)
map_View = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
map_Views = map_View
map_View.camera = GMSCameraPosition.camera(withLatitude:Double(main_latitude)!,
longitude:Double(main_longitude)!,
zoom:10.0,
bearing: 0,
viewingAngle: 0)
}