0
我已經設置了實現GMSMapViewDelegate
,將它設置爲self,並且我仍然無法讓任何代理函數工作。以下是我的代碼示例:iOS上沒有調用GMSMapViewDelegate函數
class UserViewController: UIViewController, CLLocationManagerDelegate, GMSMapViewDelegate {
var mapView: GMSMapView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
if mapView == nil {
mapView = GMSMapView()
}
mapView.delegate = self
}
func mapView(mapView: GMSMapView, didChangeCameraPosition position: GMSCameraPosition) {
print(position)
}
func mapView(mapView: GMSMapView, willMove gesture: Bool) {
print(gesture)
}
func mapView(mapView: GMSMapView, idleAtCameraPosition position: GMSCameraPosition) {
print(position)
}
的MapView功能打印任何東西都沒有。我已經檢查了代表並知道它已正確設置。我錯過了什麼嗎?
我對使用Google地圖的其他方面(例如設置地點和標記)沒有任何問題。這只是代表職能,我一直在遇到問題。 –
給你的代碼,你想實現這些,編輯你的文章:)不能真的幫助否則閱讀: - http://stackoverflow.com/help/how-to-ask – Dravidian
你是否從你的地圖視圖連接到當前類 –