قالب وردپرس درنا توس
Home / IOS Development / ios – How do you get the UIView example for a Google Map marker?

ios – How do you get the UIView example for a Google Map marker?



I want to show a VC as a popup when the user tapes one of the markers on Google Map.

The reason I want to do this is because I want to control the display that appears when the cursor is drained. I tried to use mapView (mapView: GMSMapView, cursor InfoWindow marker: GMSMarker) delegation method. But I do not know how to create a display controller in the method that controls the cursor information window view.

To present a VC as a pop over, I did this:

  let storyboard = UIStoryboard (name: "Main", bundle: null)
la vc = storyboard.instantiateViewControllerWithIdentifier ("MarkerInfoController")
vc.modalInPopover = true
vc.modalPresentationStyle = .Popover
print (marker.iconView)
vc.popoverPresentationController! .sourceView = marker.iconView

self.presentVC (vc) // this is from EZSwiftExtensions. Don't worry about it

The problem occurs when I try to put sourceView off UIPopoverPresentationController . I thought to use iconView the property would work, but no. There is always an error stating that sourceView is not specified.

How can I get UIView the instance to the cursor so that I can assign it to sourceView

PS How to create a marker:

  func mapView (mapView: GMSMapView , didLongPressAtCoordinate coordinate: CLLocationCoordinate2D) {
leave marker = GMSMarker (position: coordinate)
marker.map = mapView
}


Source link