Answer the question
In order to leave comments, you need to log in
YndexMapKit. How to get object data to display in infobox?
Good afternoon.
It is necessary to display the object data in a small infobox at the bottom.
Here's what I'm doing now:
1. Subscribed to the YMKMapObjectTapListener listener
2. Added the listener to my mapObjects
override func viewDidLoad() {
super.viewDidLoad()
let mapObjects = mapView.mapWindow.map.mapObjects
mapObjects.addTapListener(with: self)
}
class AddressesViewController: UIViewController, YMKMapObjectTapListener {
func onMapObjectTap(with mapObject: YMKMapObject, point: YMKPoint) -> Bool {
guard let placemark = mapObject as? YMKPlacemarkMapObject else { return false }
let data = placemark.userData
print(data)
return true
}
onMapObjectTap(with mapObject: YMKMapObject, point: YMKPoint)is not always called, you have to click several times to get there, meanwhile the logs constantly show messages like "No 'name' attribute in object 1923987 in layer mapj".
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question