Skip to content

Instantly share code, notes, and snippets.

@magneticrob
Created June 7, 2017 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magneticrob/aa27f7c33067ee85ab13c423f6ac5ae5 to your computer and use it in GitHub Desktop.
Save magneticrob/aa27f7c33067ee85ab13c423f6ac5ae5 to your computer and use it in GitHub Desktop.
if let newFrame = UIApplication.shared.keyWindow?.bounds {
// Remove autoresizing constraints
self.view.translatesAutoresizingMaskIntoConstraints = false
// Add width constraint
self.view.addConstraint(NSLayoutConstraint.init(item: self.view, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: SideMenuManager.menuWidth))
// Add height constraint
self.view.addConstraint(NSLayoutConstraint.init(item: self.view, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: newFrame.size.height))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment