         return (master: masterFrame.integral, detail: detailFrame.integral)
     }
 
-    private func addChild(childViewController: UIViewController?, containerView: UIView?) {
-        guard let child = childViewController, let container = containerView else {
+    private func addChild(childViewController: UIViewController?, withFrame frame: CGRect) {
+        guard let child = childViewController else {
             return
         }
         
         addChildViewController(child)
-        child.view.translatesAutoresizingMaskIntoConstraints = true
-        child.view.frame = container.bounds
-        container.addSubview(child.view)
+        child.view.translatesAutoresizingMaskIntoConstraints = false
+        child.view.frame = frame
+        view.addSubview(child.view)
         child.didMoveToParentViewController(self)
         view.setNeedsLayout()
     }


    public override func viewDidLoad() {
        super.viewDidLoad()
        
        masterContainer = UIView(frame: CGRectZero)
        detailContainer = UIView(frame: CGRectZero)
        masterContainer!.translatesAutoresizingMaskIntoConstraints = false
        detailContainer!.translatesAutoresizingMaskIntoConstraints = false
        view.addSubview(masterContainer!)
        view.addSubview(detailContainer!)
        updateFrames()
        
        addChild(masterViewController, containerView: masterContainer)
        addChild(detailViewController, containerView: detailContainer)
    }
    
    public override func viewWillAppear(animated: Bool) {

    
    private var masterPresentationStyle: MasterPresentationStyle = .Hidden {
        didSet {
            guard let master = masterViewController else {
                return
            }
            switch masterPresentationStyle {
            
            case .Hidden:
                delegate?.splitViewController?(self, willHideMasterViewController: master)
                master.view.removeFromSuperview()
                overlayHideButton?.removeFromSuperview()

            case .Showing:
                delegate?.splitViewController?(self, willShowMasterViewController: master)
                if master.view.superview !== view {
                    view.addSubview(master.view)
                }
                overlayHideButton?.removeFromSuperview()

            case .Overlay:
                if master.view.superview !== view {
                    view.addSubview(master.view)
                }
            }
            
