Skip to content

acani/AutoLayout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutoLayout

Auto Layout helper methods

Setup: How to add a Git repository to your Xcode project

Usage:

  • Initialize a constraint with optional arguments

    Give view1 a width of 100

    let constraint = NSLayoutConstraint(item: view1, attribute: .Width, constant: 100)

    Make the tops of view1 & view2 equal

    let constraint = NSLayoutConstraint(item: view1, attribute: .Top, item: view2)
  • Create constraints for a subview with insets

    let insets = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 0)
    let constraints = NSLayoutConstraint.constraintsWithSubview(textField, subview: contentView, insets: insets)
    NSLayoutConstraint.activateConstraints(constraints)

Released under the Unlicense.

About

Auto Layout helper methods

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages