點擊時如何啓用GMSMarker?我想當一個標記點擊一個警報控制器顯示並詢問用戶是否想要保存或刪除點擊標記。那麼當按下「刪除」按鈕時,我怎麼才能得到點擊標記?以及如果按下'保存'後用戶何時訪問地圖,我該如何保存它。我有這個基本結構到目前爲止,但不知道如何實現功能:點擊時刪除GMSMarker
func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
print("didtapmarker")
let alert = UIAlertController(title: "Add this place to wishlist?",
message: "Would you like to add this to your list?",
preferredStyle: .alert)
let saveAction = UIAlertAction(title: "Save",
style: .default)
let cancelAction = UIAlertAction(title: "Remove",
style: .default)
//alert.addAction(defaultAction)
alert.addAction(saveAction)
alert.addAction(cancelAction)
self.present(alert, animated: true, completion: nil)
return false
}
那麼,我會從哪裏去?任何建議,將不勝感激。
完美。看起來我需要深入研究Core Data以及如何使用它,因爲我希望用戶能夠保存多個標記。感謝您指點我正確的方向。 –