         pinToEdge(.Right)
     }
     
-    private func pinToEdge(edge: NSLayoutAttribute) {
+    func insetFromParentHorizontally(inset: CGFloat) {
+        pinToEdge(.Left, inset: inset)
+        pinToEdge(.Right, inset: -inset)
+    }
+
+    func insetFromParentVertically(inset: CGFloat) {
+        pinToEdge(.Top, inset: inset)
+        pinToEdge(.Bottom, inset: -inset)
+    }
+    
+    func insetFromParentLeft(inset: CGFloat) {
+        pinToEdge(.Left, inset: inset)
+    }
+    
+    func insetFromParentRight(inset: CGFloat) {
+        pinToEdge(.Right, inset: -inset)
+    }
+    
+    func insetFromParentTop(inset: CGFloat) {
+        pinToEdge(.Top, inset: inset)
+    }
+    
+    func insetFromParentBottom(inset: CGFloat) {
+        pinToEdge(.Bottom, inset: -inset)
+    }
+    
+    private func pinToEdge(edge: NSLayoutAttribute, inset: CGFloat = 0) {
         let superview = self.superview!
         setTranslatesAutoresizingMaskIntoConstraints(false)
         let pin = NSLayoutConstraint(item: self,

    }
    
    // MARK: - positioning
    
    func offsetTopFromParent(offset: CGFloat) {
        let superview = self.superview!
        setTranslatesAutoresizingMaskIntoConstraints(false)
        let topOffset = NSLayoutConstraint(item: self,
            attribute: .Top,
            relatedBy: .Equal,
            toItem: superview,
            attribute: .Top,
            multiplier: 1,
            constant: offset)
        superview.addConstraint(topOffset)
    }
    
    func placeBelow(sibling: UIView, by offset: CGFloat) {
        let superview = self.superview!
        if (superview != sibling.superview!) {
            return

            toItem: superview,
            attribute: edge,
            multiplier: 1,
            constant: inset)
        superview.addConstraint(pin)
    }
    
    func alignVerticallyWith(sibling: UIView) {
        alignDimension(.CenterY, withSibling: sibling)
    }
    
    func alignHorizontallyWith(sibling: UIView) {
        alignDimension(.CenterX, withSibling: sibling)
    }
    
    private func alignDimension(dimension: NSLayoutAttribute, withSibling sibling: UIView) {
        let superview = self.superview!
        if (superview != sibling.superview!) {
            return
        }
        setTranslatesAutoresizingMaskIntoConstraints(false)
        sibling.setTranslatesAutoresizingMaskIntoConstraints(false)
        let align = NSLayoutConstraint(item: self,
            attribute: dimension,
            relatedBy: .Equal,
            toItem: sibling,
            attribute: dimension,
            multiplier: 1,
            constant: 0)
        superview.addConstraint(align)
    }
    
    // TODO: this only works if the superview is centered in its superview.
    // Can't use superview.Width as you can't base child's .CenterX on it
    // http://stackoverflow.com/questions/13867736/why-is-nslayoutattributecenterx-an-invalid-pairing-with-nslayoutattributewidth
    func distributeHorizontally(children: [UIView]) {
        if children.isEmpty {
            return
        }
        
        let superview = children[0].superview!
        for child in children {
            if child.superview != superview {
                return
            }
        }
        
        for (index, child) in enumerate(children) {
            child.setTranslatesAutoresizingMaskIntoConstraints(false)
            let multiplier = CGFloat((Float(index) + 0.5) * 2 / Float(children.count))
            let align = NSLayoutConstraint(item: child,
                attribute: .CenterX,
                relatedBy: .Equal,
                toItem: self,
                attribute: .CenterX,
                multiplier: multiplier,
                constant: 0)
            superview.addConstraint(align)
        }
    }
    
    // MARK: - sizing
