         view.layer.borderColor = UIColor.redColor().CGColor
         view.layer.borderWidth = 1
         return view
+    }
+
+    private func setupPortraitLayout() {
+        switch traitCollection.userInterfaceIdiom {
+        case .Phone:
+            setupPhonePortraitLayout()
+        case .Pad:
+            setupPadPortraitLayout()
+        default:
+            println("unknown device:\(traitCollection.userInterfaceIdiom.rawValue)")
+        }
+    }
+
+    private func setupLandscapeLayout() {
+        switch traitCollection.userInterfaceIdiom {
+        case .Phone:
+            setupPhoneLandscapeLayout()
+        case .Pad:
+            setupPadLandscapeLayout()
+        default:
+            println("unknown device:\(traitCollection.userInterfaceIdiom.rawValue)")
+        }
     }
 
     private func setupPhonePortraitLayout() {

            miniView[.Bottom] == baseView[.Bottom] - 8,
            ])
    }
}

        baseView.addSubview(infoView)
        miniView = createView(UIColor.yellowColor())
        baseView.addSubview(miniView)

        setupPortraitLayout()
    }

    override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
        if size.height > size.width {
            setupPortraitLayout()
        }
        else {
            setupLandscapeLayout()
        }
    }

