{"action":"created","issue":{"url":"https://api.github.com/repos/SnapKit/Masonry/issues/235","labels_url":"https://api.github.com/repos/SnapKit/Masonry/issues/235/labels{/name}","comments_url":"https://api.github.com/repos/SnapKit/Masonry/issues/235/comments","events_url":"https://api.github.com/repos/SnapKit/Masonry/issues/235/events","html_url":"https://github.com/SnapKit/Masonry/issues/235","id":105178228,"number":235,"title":"How to set constraint from bottomLayoutGuide to view","user":{"login":"allting","id":508981,"avatar_url":"https://avatars.githubusercontent.com/u/508981?v=3","gravatar_id":"","url":"https://api.github.com/users/allting","html_url":"https://github.com/allting","followers_url":"https://api.github.com/users/allting/followers","following_url":"https://api.github.com/users/allting/following{/other_user}","gists_url":"https://api.github.com/users/allting/gists{/gist_id}","starred_url":"https://api.github.com/users/allting/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allting/subscriptions","organizations_url":"https://api.github.com/users/allting/orgs","repos_url":"https://api.github.com/users/allting/repos","events_url":"https://api.github.com/users/allting/events{/privacy}","received_events_url":"https://api.github.com/users/allting/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SnapKit/Masonry/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-07T09:08:57Z","updated_at":"2015-09-10T20:59:51Z","closed_at":null,"body":"I had been converting the following project to use autolayout programmatically.\r\nhttps://github.com/ISBX/apprtc-ios\r\n\r\n```objective-c\r\n-(NSLayoutConstraint*)topConstraintWithRemoteView:(UIView*)remoteView{\r\n    NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:remoteView\r\n                                                                     attribute:NSLayoutAttributeTop\r\n                                                                     relatedBy:NSLayoutRelationEqual\r\n                                                                        toItem:self.view\r\n                                                                     attribute:NSLayoutAttributeTop\r\n                                                                    multiplier:1.f\r\n                                                                      constant:0];\r\n    \r\n    topConstraint.priority = 1000;\r\n    return topConstraint;\r\n}\r\n\r\n-(NSLayoutConstraint*)leftConstraintWithRemoteView:(UIView*)remoteView{\r\n    NSLayoutConstraint *leftConstraint = [NSLayoutConstraint constraintWithItem:remoteView\r\n                                                                      attribute:NSLayoutAttributeLeading\r\n                                                                      relatedBy:NSLayoutRelationEqual\r\n                                                                         toItem:self.view\r\n                                                                      attribute:NSLayoutAttributeLeading\r\n                                                                     multiplier:1.f\r\n                                                                       constant:0];\r\n\r\n    leftConstraint.priority = 1000;\r\n    return leftConstraint;\r\n}\r\n\r\n-(NSLayoutConstraint*)rightConstraintWithRemoteView:(UIView*)remoteView{\r\n    NSLayoutConstraint *rightConstraint = [NSLayoutConstraint constraintWithItem:self.view\r\n                                                                       attribute:NSLayoutAttributeTrailing\r\n                                                                       relatedBy:NSLayoutRelationEqual\r\n                                                                          toItem:remoteView\r\n                                                                       attribute:NSLayoutAttributeTrailing\r\n                                                                      multiplier:1.f\r\n                                                                        constant:0];\r\n    \r\n    \r\n    rightConstraint.priority = 1000;\r\n    return rightConstraint;\r\n}\r\n\r\n-(NSLayoutConstraint*)bottomConstraintWithRemoteView:(UIView*)remoteView{\r\n    NSLayoutConstraint *bottomConstraint = [NSLayoutConstraint constraintWithItem:self.bottomLayoutGuide\r\n                                                                        attribute:NSLayoutAttributeTop\r\n                                                                        relatedBy:NSLayoutRelationEqual\r\n                                                                           toItem:remoteView\r\n                                                                        attribute:NSLayoutAttributeBottom\r\n                                                                       multiplier:1.f\r\n                                                                         constant:0];\r\n\r\n    bottomConstraint.priority = 1000;\r\n    return bottomConstraint;\r\n}\r\n```\r\n\r\n```objective-c\r\n    renderer.topConstraint = [self topConstraintWithRemoteView:remoteView];\r\n    renderer.leftConstraint = [self leftConstraintWithRemoteView:remoteView];\r\n    renderer.rightConstraint = [self rightConstraintWithRemoteView:remoteView];\r\n    renderer.bottomConstraint = [self bottomConstraintWithRemoteView:remoteView];\r\n    \r\n    [self.view addConstraints:@[renderer.topConstraint, renderer.leftConstraint, renderer.rightConstraint, renderer.bottomConstraint]];\r\n\r\n```\r\n\r\nNow I'm converting autolayout to Masonry.\r\n\r\n```objective-c\r\n    [remoteView mas_makeConstraints:^(MASConstraintMaker *make) {\r\n        renderer.topConstraint = make.top.equalTo(self.view.mas_top).with.offset(0).with.priorityHigh();\r\n        renderer.leftConstraint = make.leading.equalTo(self.view.mas_leading).with.offset(0).with.priorityHigh();\r\n        // HERE: How could I convert view items for right and bottom?\r\n        renderer.rightConstraint = make.trailing.equalTo(self.view.mas_trailing).with.offset(0).with.priorityHigh();\r\n        renderer.bottomConstraint = make.bottom.equalTo(self.view.mas_bottom).with.offset(0).with.priorityHigh();\r\n    }];\r\n```\r\n\r\nHow could I convert view items for right and bottom constraint?"},"comment":{"url":"https://api.github.com/repos/SnapKit/Masonry/issues/comments/139377275","html_url":"https://github.com/SnapKit/Masonry/issues/235#issuecomment-139377275","issue_url":"https://api.github.com/repos/SnapKit/Masonry/issues/235","id":139377275,"user":{"login":"robertjpayne","id":214288,"avatar_url":"https://avatars.githubusercontent.com/u/214288?v=3","gravatar_id":"","url":"https://api.github.com/users/robertjpayne","html_url":"https://github.com/robertjpayne","followers_url":"https://api.github.com/users/robertjpayne/followers","following_url":"https://api.github.com/users/robertjpayne/following{/other_user}","gists_url":"https://api.github.com/users/robertjpayne/gists{/gist_id}","starred_url":"https://api.github.com/users/robertjpayne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertjpayne/subscriptions","organizations_url":"https://api.github.com/users/robertjpayne/orgs","repos_url":"https://api.github.com/users/robertjpayne/repos","events_url":"https://api.github.com/users/robertjpayne/events{/privacy}","received_events_url":"https://api.github.com/users/robertjpayne/received_events","type":"User","site_admin":false},"created_at":"2015-09-10T20:59:51Z","updated_at":"2015-09-10T20:59:51Z","body":"@allting most of the time you should be pinning *to* the layout guides not from it. It should work either way though so can you try that?\r\n\r\nI don't think the layout guides will \"move\" hence why you want to pin *to* them."}}