Gael.D
Gael.D

Reputation: 500

Adding Custom Image on Mkannotationview, or on callout bubble?

i'm trying to reproduce the kind of map behavior of the app "Stuck On Earth". Here's a screenshot : enter image description here

Here's the behavior :

I'm trying to do something similar. For now, as i can read, i've got two solutions :

  1. Using callout : callout is HELL. I can try to use a false annotation, but MapKit deals with the depth of elements, and the picture is always in front of the pin
  2. Using Custom Annotation : i was going for the plan of making custom annotation view, when the pin is tapped, i launch a method of the CustomAnnotationView, adding (or removing) the thumbnail.

I think the method number 2 could work, but i've got no idea how to deal with the touch on the thumbnail.

Any suggestions or help on this ? Thanks you !

Upvotes: 1

Views: 479

Answers (1)

user746403
user746403

Reputation: 73

Updated 2016-09-02:

My colleague devised an workaround by making popup views as subview of the view container which contains the map view. The position can be calculated according to the CGPoint transform in different reference systems.

Original Answer:

I also got this kind of problem, after following the tutorial 'Building Custom Map Annotation Callouts – Part 1', the interaction becomes difficult.

Have you tried the tap gesture recognizer? I added it to a subview, it works, although the code smell bad.

Upvotes: 0

Related Questions