本文介绍了IB Designables:无法呈现和更新Google Maps的自动布局状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在项目中使用GoogleMaps Pod.我的故事板之一出现错误:
I'm using GoogleMaps Pod in my project. I have error in one of my Storyboard:
我已将视图类设置为GMSMapView:
I have set view class to GMSMapView:
应用程序正在模拟器上运行.我该如何解决此错误?这会导致整个情节提要空白.
App is working on simulator. How I can fix this error? It causes whole storyboard to be blank.
推荐答案
通过在模拟器中编写代码来手动使用GMSMapView;而不是在情节提要中使用GMSMapView
.
Use GMSMapView manually by writing code in simulator; Instead of using GMSMapView
in storyboard.
如果要在多个屏幕中使用地图.然后手动为所有文件编写代码.
If you are using maps in multiple screen. then write code manually for all file.
@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)
}
这篇关于IB Designables:无法呈现和更新Google Maps的自动布局状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!