点击时如何启用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以及如何使用它,因为我希望用户能够保存多个标记。感谢您指点我正确的方向。 –