{"action":"created","issue":{"url":"https://api.github.com/repos/SnapKit/SnapKit/issues/101","labels_url":"https://api.github.com/repos/SnapKit/SnapKit/issues/101/labels{/name}","comments_url":"https://api.github.com/repos/SnapKit/SnapKit/issues/101/comments","events_url":"https://api.github.com/repos/SnapKit/SnapKit/issues/101/events","html_url":"https://github.com/SnapKit/SnapKit/issues/101","id":82174544,"number":101,"title":"TopLayoutGuide constraints is not applied when UIView constructed with InterfaceBuilder","user":{"login":"confile","id":64265,"avatar_url":"https://avatars.githubusercontent.com/u/64265?v=3","gravatar_id":"","url":"https://api.github.com/users/confile","html_url":"https://github.com/confile","followers_url":"https://api.github.com/users/confile/followers","following_url":"https://api.github.com/users/confile/following{/other_user}","gists_url":"https://api.github.com/users/confile/gists{/gist_id}","starred_url":"https://api.github.com/users/confile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/confile/subscriptions","organizations_url":"https://api.github.com/users/confile/orgs","repos_url":"https://api.github.com/users/confile/repos","events_url":"https://api.github.com/users/confile/events{/privacy}","received_events_url":"https://api.github.com/users/confile/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SnapKit/SnapKit/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-05-28T23:44:31Z","updated_at":"2015-05-29T13:58:31Z","closed_at":null,"body":"I created a UIViewController with a xib file. Here is my .xib content: \r\n\r\n![page1viewcontroller_xib](https://cloud.githubusercontent.com/assets/64265/7873543/e3b794ae-05a3-11e5-98aa-07de2456621c.png)\r\n\r\nHere is the controller code: \r\n```\r\nimport UIKit\r\n\r\n@objc(Page1ViewController)\r\nclass Page1ViewController: UIViewController {\r\n  \r\n  \r\n  @IBOutlet weak var view2: UIView!\r\n  \r\n  \r\n  override func viewDidLoad() {\r\n    super.viewDidLoad()\r\n    \r\n    let view1 = UIView(frame: CGRectMake(50, 50, 100, 200))\r\n    view1.backgroundColor = UIColor.greenColor()\r\n    self.view.addSubview(view1)\r\n    \r\n    \r\n    view1.snp_makeConstraints { (make) -> Void in\r\n      make.top.equalTo(self.topGuide.snp_bottom)\r\n      make.left.equalTo(self.view.snp_left)\r\n      make.size.equalTo(100)\r\n    }\r\n    \r\n  }\r\n \r\n  \r\n  override func viewWillAppear(animated: Bool) {\r\n    view2.snp_makeConstraints { (make) -> Void in\r\n      make.top.equalTo(self.topGuide.snp_bottom)\r\n      make.left.equalTo(self.view.snp_left).offset(100)\r\n      make.size.equalTo(100)\r\n      \r\n    }\r\n  }\r\n  \r\n  \r\n}\r\n\r\n\r\n\r\n\r\n// For SnapKit\r\nextension UIViewController {\r\n  var bottomGuide: UIView {\r\n    return self.bottomLayoutGuide as! UIView\r\n  }\r\n  \r\n  var topGuide: UIView {\r\n    return self.topLayoutGuide as! UIView\r\n  }\r\n}\r\n```\r\n\r\nWhen I run the app you see the following: \r\n\r\n![ios_simulator_-_iphone_6_-_iphone_6___ios_8_4__12h4098c_](https://cloud.githubusercontent.com/assets/64265/7873560/1dd2af5c-05a4-11e5-84cf-61ad5f5b86ca.png)\r\n\r\nThe green view which has been created in code works perfect with the bottom of the topLayoutGuide but the blue view which has been created with interface builder does not work correct.\r\n"},"comment":{"url":"https://api.github.com/repos/SnapKit/SnapKit/issues/comments/106811996","html_url":"https://github.com/SnapKit/SnapKit/issues/101#issuecomment-106811996","issue_url":"https://api.github.com/repos/SnapKit/SnapKit/issues/101","id":106811996,"user":{"login":"confile","id":64265,"avatar_url":"https://avatars.githubusercontent.com/u/64265?v=3","gravatar_id":"","url":"https://api.github.com/users/confile","html_url":"https://github.com/confile","followers_url":"https://api.github.com/users/confile/followers","following_url":"https://api.github.com/users/confile/following{/other_user}","gists_url":"https://api.github.com/users/confile/gists{/gist_id}","starred_url":"https://api.github.com/users/confile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/confile/subscriptions","organizations_url":"https://api.github.com/users/confile/orgs","repos_url":"https://api.github.com/users/confile/repos","events_url":"https://api.github.com/users/confile/events{/privacy}","received_events_url":"https://api.github.com/users/confile/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T13:58:31Z","updated_at":"2015-05-29T13:58:31Z","body":"@robertjpayne Here is the demo I made. Just run the code and you see the problem: \r\n\r\nhttps://github.com/confile/SnapKit-Test"}}