-
-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use as callout view in MKMapView
#175
Comments
The code seems fine, have you inspected the view hierarchy? Where is the tip placed? |
Hi @andreamazz, the tip placement looks perfect, it's only when the map is panned that the original pin moves away and the tip remains where it was, i.e. it doesn't pan with the map. In the above chunk of code bear in mind that the "view" parameter is the |
Ok, I see, when you pan around the map view handles the annotations separately, if the tip is presented |
Well, my map annotation is a simple |
Add it to the annoationView, turn off clipping if it's too small, and adjust the from frame (origin in the middle of the annoationview's frame, and size 1px by 1px). |
I tried:
As you can see, something weird is happening this way, even the arrow is a bit off to the right for some reason. The tip stays with the annotation when the map moves around, so that part is fine, but the positioning is not right. |
Mh, it might be trying to constraint the bubble inside the tiny view. 🤔 |
If I make the frame of the annotationView big enough to fit the tip then the frames of the different pins start overlapping and tapping one pin opens up another one's callout. Even if I manage to fix this somehow, it will be a hacky solution and it's best if you can patch it up on your side if you have any ideas how to do it. |
What's weird is that the little point triangle is always positioned correctly in relation to the pin, it's just the bubble that goes off when the frame is too small. |
Yeah I mean to test this out as a temporary way to determine if my assumption is correct. If by enlarging the pin the poptip shows and moves fine I'll go on with the fix that I have in mind. |
It does. |
Ok, gotcha, I'll see if I can push a quick fix by making the constraint optional |
I've attempted a blind fix in bbfe443 |
Hey @andreamazz, sure I can, just give me some info about how I should do it. |
If you use CococaPods just use
Set the |
@andreamazz this is what I have now:
and here is the result: It's better than before because I didn't have to do any work on the original pin's frame in order to get this to work, but it still seems off a bit. I'm guessing maybe the rounded corners are an issue? |
Nah, it's still trying to constraint the view inside the pin. |
Sure, how would you like me to share it with you? |
Create a quick repo if it can be public, or just send an email at andrea |
I've sent you an email with the demo project. |
Great, thanks, I'll look into it |
@andreamazz thanks! This may help you, from what I can see the issue is dual:
|
The issue seems to be resolved now. Thanks! Will you be pushing this to the main branch soon? |
@andreamazz This seems to disable the |
@andreamazz Any new info on this? Can I help or contribute somehow? |
Sorry, I'm a little swamped at work in these days. |
I did a little testing, and here's what I've found: In the demo app, I modified the "attributed text" pop tip case like so
to achieve the same scenario as I'm using it in the map. This caused the view to go a bit out of bounds of the screen, but that's not a problem for me. However the tap of the view is no longer working, as I previously reported. As explained in the Apple docs, the tap gesture recognizer only works on subviews which are not clipped by the bounds of their superview, which is exactly the case here. In order to get this to work, what I needed to do was make a custom class for my view which holds the pop tip, and override the
I don't see how this could be fixed by your library, and I don't think it's even your job to find a solution for this, but if you have something in mind then feel free to include it and make it even better for future users. As far as I am concerned, you can consider this issue resolved. Thanks for all your help! |
Sounds good. I’ll release a new version on CocoaPods as soon as possible. |
I tried presenting the poptip when a user taps on a
MKAnnotationView
in aMKMapView
, to act as a custom callout view like so:but the bubble is not attached to the annotation view, and it doesn't move with it when the map is panned but just stays in one place. Is there a way to achieve this?
The text was updated successfully, but these errors were encountered: