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

Add shorthand edges pin functions #176

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

revolter
Copy link
Member

@revolter revolter commented Apr 5, 2017

Having sameAxis functions, I don't see why shouldn't we have sameEdge functions too. And already this would clear some code from my codebase, so you don't have to figure out if the edge and toEdge parameters are the same one.

Copy link
Contributor

@mickeyreiss mickeyreiss left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @revolter!

I do like the autoPinEdge:toSameEdgeOfView: signatures.

I left one question on the other API.

I'd love to hear some more community feedback before merging this in. Once it's in, we can never go back. Any one else have thoughts?

- (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toSameEdgeOfView:(ALView *)otherView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation;

/** Pins the edges of the view to the edges of another view. */
- (PL__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToEdgesOfView:(ALView *)otherView;
Copy link
Contributor

Choose a reason for hiding this comment

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

This one seems a bit niche to me. Can you explain the use case for this one that isn't covered by autoPinEdgesToSuperviewEdges?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, as the name suggests, this is used to match 2 views that aren't in a parent - child relationship. For example, say I have a UIImageView and a UIView that I want the view to be in the same position and with the same size of the image view, but I can't add it as a subview to it, because you're not supposed to do that.

@revolter
Copy link
Member Author

revolter commented Apr 6, 2017

Thanks for the PR

My pleasure! Thank you all for the library.

I do like the autoPinEdge:toSameEdgeOfView: signatures.

Of course you do, as it's taken from the autoAlignAxis:toSameAxisOfView: 😛

I'd love to hear some more community feedback before merging this in. Once it's in, we can never go back.

Makes sense, I'll just wait here 😄

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

Successfully merging this pull request may close these issues.

None yet

2 participants