             self.dismissViewControllerAnimated(true, completion: nil)
         }
     }
+    
+    public override func willRotateToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) {
+        rotatingContentH = view.frame.height - content.view.frame.origin.y
+    }
+    
+    public override func willAnimateRotationToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) {
+        let contentS = content.preferredContentSize
+        let viewS = view.frame.size
+    
+        UIView.animateWithDuration(duration) { 
+            self.content.view.frame = CGRect(x: (viewS.width - contentS.width) / 2, y: viewS.height - self.rotatingContentH, width: contentS.width, height: contentS.height)
+        }
+    }
+    
+    public required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+}
+
+// Gesture
+extension FOPopupController {
     
     func pan(recognizer: UIPanGestureRecognizer) {
         let translation = recognizer.translationInView(recognizer.view)

        
        return (up == max ? nil : up, down == max ? nil : down)
    }
    
    public required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}

extension FOPopupController: UIViewControllerTransitioningDelegate {

        } else {
            UIView.animateWithDuration(0.3, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0, options: .CurveEaseOut, animations: {
                self.content.view.frame = CGRect(x: self.content.view.frame.origin.x, y: point.y, width: self.content.view.frame.width, height: self.content.view.frame.height)
                }, completion: nil)
        }
    }
    
