objective-cmkmapviewmkannotationmkannotationviewmkpinannotationview

How to add text under the button previously placed as leftCalloutAccessoryView of MKPinAnnotationView


I want to basically do this: ETA info under the button with a car image

How can I add text just at the bottom of the button? Thanks in advance.


Solution

  • I have found the solution a long time ago but forgot to mention it here.

    Here it is:

    Just create a Vertical StackView, set its alignment as Center and distribution as Fill, and put your label and image in it. Make your label hidden at first. Assign the StackView as the leftCalloutAccessoryView. When you got the ETA info, just make the label unhidden inside an animation code.

    That's it! It will behave just like in the Apple's Map app.