Reputation: 21
I want to make my app open another View Controller on the tap of an already present place on the map. When you open a map there are many places shown on map with their names i think they are called land marks. I want to make it so when a user selects such landmark i show information to him about it. The problem is I want that user directly clicks on such place and don't want to make annotations on map Is this possible?
Upvotes: 1
Views: 246
Reputation: 21
You can show those from iOS 16 using selectableMapFeatures. It would look like this in your viewDidLoad:
mapView.selectableMapFeatures = [.pointsOfInterest]
Then to use the default callout from Apple you'll need this where you conform to MKMapViewDelegate:
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
return nil
}
But you can customize it, get more information from the annotation etc. Here's a link to the Apple WWDC about it. https://developer.apple.com/videos/play/wwdc2022/10035/
The part you want is at about the 20 minute mark.
Upvotes: 0