-
Notifications
You must be signed in to change notification settings - Fork 53
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
Arrow not always drawn correctly #4
Comments
I chased this bug on a few occasions and never arrived at a good solution :-( Sent from my iPhone.
|
I just sent a pull request which fixes this. I'm trying to decide whether this is a bug I should report to Apple and am curious as to your opinion. The fundamental problem is that the change to the center coordinate does not take effect immediately. I added a bunch of NSLog statements to illustrate: 2013-10-12 11:04:12.836 CalloutDemo[45488:a0b] In relativeParentXPosition: 2013-10-12 11:04:12.839 CalloutDemo[45488:a0b] Before changing center coordinate: 2013-10-12 11:04:12.846 CalloutDemo[45488:a0b] In relativeParentXPosition: You can see that only towards the very end do the center coordinate and the origin of the parent annotation start to change. This happens after drawRect has run, and since the distance to the arrow is in the map view's coordinates, this results in us getting an incorrect value. Switching from animated:YES to animated:NO on the call to setCenterCoordinate makes the new center coordinate take effect immediately but the map view still doesn't shift until sometime later, as the parent annotation origin shows: 2013-10-12 11:44:02.628 CalloutDemo[46233:a0b] In relativeParentXPosition: 2013-10-12 11:44:02.631 CalloutDemo[46233:a0b] Before changing center coordinate: 2013-10-12 11:44:02.701 CalloutDemo[46233:a0b] In relativeParentXPosition: So what do you think, is this a bug I should report, or just an inconvenience we need to work around? |
Interesting issue. Haven't looked in iOS 7 to see if we get any new mapView animation blocks that would benefit something like this. I imagine the duration of the recenter animation is a bit more flexible than it is elsewhere in UIKit, so a simple .25 - .3 second block delay may not cut it in every case. I'd consider at least filing an ER for some better hooks during mapView animations. G Sent from my iPhone.
|
This is something I discovered in the code from asynchrony.com that you based yours off of. I've been trying to fix it with no success so far, so I went looking to see if there were other good alternatives. It turns out yours does the same thing:
There is no arrow pointing to the pin, but there is a small line jutting out from the lower right corner of the annotation. I believe this is an artifact of the arrow being drawn incorrectly, because if you now dismiss and recall the annotation, the arrow is present and the line is gone.
If you do the same thing and move the pin to the left edge of the screen, the arrow is drawn but it's in the wrong place. Something about the view being moved so that the whole annotation will display is causing this, but so far I have not been able to fix it. Suggestions welcome!
The text was updated successfully, but these errors were encountered: