iOS - Issue Creating Custom MKAnnotation Callout
Asked Answered
S

2

8

Im having some issues styling my MKAnnotation callout bubble. Originally I had a standard callout that consisted of just a title, subtitle and leftCalloutAccessoryView. This created the following callout:

enter image description here

This worked fine until it was decided that the subtitle should also contain a series of five images that show the business's average ratting among user reviews. This was done by creating a separate view and passing it as the detailCalloutAccessoryView. This produced the following callout bubble:

enter image description here

For some reason when the view is passed to the detailCalloutAccessoryView the callout view is given a weird border around all UI components that create unwanted whitespace around the leftCalloutAccessoryView and between the title and subtitle. How can I remove this white space? I want the business's average ratting inside the subtitle and proper spacing between the title and detailCalloutAccessoryView. How can this be achieved? Is it possible to do so without creating the callout from scratch?

Stiletto answered 10/11, 2015 at 4:34 Comment(3)
Did you ever solve this?Fusiform
no I was never able to solve this.Stiletto
Can you share code and UIView which you have created for callout?Isopod
D
0

Without code, it is hard to give a detailed answer.
But I found a hint that may solve your problem in this post:
Apparently, MapKit sets translatesAutoresizingMaskIntoConstraints to false, when you set a view to detailCalloutAccessoryView.
This means that you have to set auto layout constraints by your own.

Drennan answered 21/4, 2019 at 11:48 Comment(1)
@ScottOBot: Did you try to set auto layout constraints?Vudimir
G
0

I suggest you create one custom pin representing the Bubble (BubblePin), and each time the user selects one regular pin, you add the BubblePin at the same position of the last selected regular pin. So adding one additional pin and switching its position according to the user selection will solve the problem, just make sure to add the BubblePin some offset so it won't be right on top of the regular one.

Glum answered 24/4, 2019 at 14:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.