Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[ios] Only use non nil presentationLayers to adjust annotation views #7626

Merged
merged 1 commit into from
Jan 8, 2017

Conversation

boundsj
Copy link
Contributor

@boundsj boundsj commented Jan 8, 2017

Views that are added outside of the viewport do not always have an instantiated presentationLayer. Attempting to use a nil presentationLayer to move a view offscreen resulted in the view being pinned to the left side of the view port (at x == 0).

Fixes #7558

Views that are added outside of the viewport do not always have an
instantiated presentationLayer. Attempting to use a nil
presentationLayer to move a view offscreen resulted in the view
being pinned to the left side of the view port (at x == 0).
@boundsj boundsj added annotations Annotations on iOS and macOS or markers on Android bug iOS Mapbox Maps SDK for iOS labels Jan 8, 2017
@boundsj boundsj added this to the ios-v3.4.0 milestone Jan 8, 2017
@boundsj boundsj self-assigned this Jan 8, 2017
@boundsj boundsj requested a review from 1ec5 January 8, 2017 01:04
@mention-bot
Copy link

@boundsj, thanks for your PR! By analyzing this pull request, we identified @1ec5, @incanus and @friedbunny to be potential reviewers.

Copy link
Contributor

@1ec5 1ec5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, that’ll do it!

adjustedFrame.origin.x = -CGRectGetWidth(annotationView.layer.presentationLayer.frame) * 10.0;
} else {
// views that are added off screen do not have a presentationLayer
adjustedFrame.origin.x = -CGRectGetWidth(adjustedFrame) * 10.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, an off-screen view may not have a presentation layer, but it still has a layer.

@boundsj boundsj merged commit 901c806 into release-ios-v3.4.0 Jan 8, 2017
@boundsj boundsj deleted the boundsj-fix-stuck-annotation-views branch January 8, 2017 20:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
annotations Annotations on iOS and macOS or markers on Android bug iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants