Reputation: 76
I have a view to a calloutDetail:
annotationView.detailCalloutAccessoryView = mapInformationView.view
It is working just fine, but I don't want to display a title/subtitle, just my custom view. But when I left title/subtitle empty the callout isn't displayed.
So, How can I hide them or just change their font size and name?
Upvotes: 5
Views: 705
Reputation: 5155
One way to hide the title (or subtitle) label is to set the MKAnnotation
's title
(or subtitle
) property to nil
.
If you want the title to show on the marker, but not on the callout, toggle the title
value in a subclass of MKAnnotationView
overriding setSelected(_:animated:)
.
override func setSelected(_ selected: Bool, animated: Bool) {
if selected {
annotation.title = nil
} else {
annotation.title = "Title"
}
super.setSelected(selected, animated: animated)
}
Upvotes: 0