Skip to content
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

Annotations going crazy when changing map layout and center #11

Open
zfrankz opened this issue Mar 9, 2015 · 8 comments
Open

Annotations going crazy when changing map layout and center #11

zfrankz opened this issue Mar 9, 2015 · 8 comments
Labels
Milestone

Comments

@zfrankz
Copy link

zfrankz commented Mar 9, 2015

Hello, I have a "layout changing" map view (changes the height of the view with some user interactions) and those changes (changing map center coordinates as well) make the annotations going crazy, changing their positions and some disappearing!

Screenshots:

https://www.dropbox.com/s/t3kmqytjzl6wtx9/crazy1.png?dl=0

When I select the annotation in the first "O" of London I change the height of the map and on didSelectAnnotationView: delegation method I do [self.theMap setCenterCoordinate:theannotation.coordinate animated:YES];

That's what I have:
https://www.dropbox.com/s/hdi2n9nwb848974/crazy2.png?dl=0

As you can see, the annotation has been displaced and any other annotations are gone!

@ashare80
Copy link
Owner

ashare80 commented Mar 9, 2015

If you could try the code on the Develop branch and see if there's any change to you results. Will look into this further.

@zfrankz
Copy link
Author

zfrankz commented Mar 10, 2015

Hello, I'm testing the new code and I realised that now, when an annotation is selected in the map, the class of this annotation view has changed. For example, if is a clustered one, now is member of my custom clustered class instead of the TSClusterAnnotationView class. I haven't checked the changes on the code but at first instance I thought it was because iOS 8.2 (I updated a device) but I tried in a different one and still happening the same. Are you aware of it? Anyway, I made some changes to adapt my code to that new "feature".

Well, coming back to the issue, now the annotations seem to be not so crazy but, after few times expanding/collapsing a clusterAnnotation, I can see how is "moving" to the left (I think is the #8 issue)

@ashare80
Copy link
Owner

@zfrankz Yes it was pointed out to me that the TSClusterAnnotationView was being returned instead of the custom cluster annotation view class provided which is a bug. The reason being you'll never have access to the correct annotation when the cluster is split into individual annotations. TSClusterAnnotationView will always point to the wrapper cluster annotation and never the original annotation that you added to the mapView.

Also for any visual changes, you don't want to be making changes to TSClusterAnnotationView

Still looking into #8

@zfrankz
Copy link
Author

zfrankz commented Mar 11, 2015

Ok, please tell me when that bug is solved because I will need access to the custom annotationView to change the image sometimes to make them look as "selected" (the user can select them from a list of locations).

Now with the new code, all the annotations make a kind of blinking when they are "relocated" because of the change of the layout but at least they are not disappearing!

Thanks

@ashare80 ashare80 added this to the 2.0.2 milestone Mar 13, 2015
@ashare80 ashare80 added the bug label Mar 13, 2015
@ashare80 ashare80 modified the milestones: 2.0.3, 2.0.2 Mar 16, 2015
@ashare80
Copy link
Owner

@zfrankz I'm assuming your map height change is animated? Recreated something like you describe with an animated change of the layout constraints to the mapView.

I believe there's a clashing of the UIView animation in the clustering and the animated layout of subviews during an animated change of the frame or constraints.

Working on a fix to the problem.

@zfrankz
Copy link
Author

zfrankz commented Mar 30, 2015

Yes, is animating the height of the map view. Thanks for the support.

@zfrankz
Copy link
Author

zfrankz commented May 26, 2015

Changing the height of the map is very heavy for some devices so I decided to change map region offset instead.

@ashare80
Copy link
Owner

@zfrankz Nice that's probably the better way to do it.

Since annotations are treated as subviews they re-layout during frame changes which causes the problems with animations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants