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

Added support UIViewController's topLayoutGuide and bottomLayoutGuide #212

Closed
wants to merge 1 commit into from

Conversation

raylillywhite
Copy link

This improves the API for using UIViewController's topLayoutGuide and bottomLayoutGuide with Masonry by adding mas_topLayoutGuide and mas_bottomLayoutGuide to UIViewController, and fixes issues in iOS 9 (#207) from assuming that the topLayoutGuide and bottomLayoutGuide are UIViews (as described in #27).

A couple things to note:

  • MASViewAttribute's view property will contain a UILayoutSupport that, at least in iOS 9, is not really a view. Should MASViewAttribute be renamed to something like MASLayoutAttribute and its view property changed to an id with a name like receiver?
  • I changed the logic for determining which view to install the constraint on to more closely match SnapKit's logic because in iOS 9 the common superview calculation won't work since the layout guides are not views. But that changes which view width/height constraints get installed to (the new behavior seems to match SnapKit, and doesn't seem to cause any problems in my project, but I'm not sure if it could cause problems in other projects). I think this could be prevented by inverting part of SnapKit's logic and instead of installing it on the first view's superview if it exists, first check if it's a width/height constraint, and if so, install on the first view directly.

This improves the API for using topLayoutGuide and bottomLayoutGuide via Masonry, and fixes crashes in iOS 9 from assuming that the topLayoutGuide and bottomLayoutGuide are UIViews
@raylillywhite
Copy link
Author

Looks like #214 does the same thing and addresses both of the concerns listed above (and it includes tests as well). #214 added the id item property on MASViewAttribute and maintained consistent behavior for width/height constraints with previous versions, which I assume is the route we'd want to take on both of those, so I'll just close this.

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

Successfully merging this pull request may close these issues.

1 participant