         topViewController?.willMoveToParentViewController(nil)
         viewController.view.translatesAutoresizingMaskIntoConstraints = false
         self.addChildViewController(viewController)
-        self.addSubview(viewController.view, toView:self.contentView)
+        self.contentView.addSubview(viewController.view)
+        self.contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|[subView]|",
+            options: [], metrics: nil, views: ["subView":viewController.view]))
+        self.contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|[subView]|",
+            options: [], metrics: nil, views: ["subView":viewController.view]))
+
 
         if animated {
             animateChangeContentViewController(viewController)

    override public func viewDidLoad() {
        super.viewDidLoad()

        setupViews()
    }


import UIKit

// MARK: - Protocols -
