Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Use Native convertRect:, convertPoint: Methods to Handle Nil Cases#2889

Merged
Adlai-Holler merged 3 commits intomasterfrom
AHConvertToNilNode
Jan 11, 2017
Merged

Use Native convertRect:, convertPoint: Methods to Handle Nil Cases#2889
Adlai-Holler merged 3 commits intomasterfrom
AHConvertToNilNode

Conversation

@Adlai-Holler
Copy link
Copy Markdown
Contributor

Resolves #2888 @hannahmbanana

I didn't know this, but convertPoint:toLayer:nil behaves a lot differently from convertPoint:toView:nil and so it's important that we call the appropriate method for the appropriate case.

@garrettmoon
Copy link
Copy Markdown
Contributor

I'm not positive this is an issue, but CALayer and UIView document different behavior when the view / layer is nil.

CALayer:
"If you specify nil for the layer parameter, this method returns the original point subtracted from the layer's frame's origin."

UIView:
"If view is nil, this method instead converts to window base coordinates."

@Adlai-Holler
Copy link
Copy Markdown
Contributor Author

@garrettmoon It's true the behavior changes, but I think it's reasonable for us to do the layer-thing for layer-backed nodes, and the view-thing for view-backed nodes.

Copy link
Copy Markdown
Contributor

@garrettmoon garrettmoon left a comment

Choose a reason for hiding this comment

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

One final comment: could you add documentation to these methods which says it mirror's UIView's behavior and not CALayer's?

@Adlai-Holler Adlai-Holler merged commit 7c4ee35 into master Jan 11, 2017
@Adlai-Holler Adlai-Holler deleted the AHConvertToNilNode branch January 11, 2017 21:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants