         }
     }
 
+    private func parentViewHeight() -> CGFloat {
+        return superview?.frame.height ?? UIScreen.mainScreen().bounds.size.height
+    }
+
 }
 
 @objc

        }
        let screenSize = UIScreen.mainScreen().bounds.size
        UIView.animateWithDuration(0.2) {
            self.frame = CGRectMake(0, screenSize.height - 260.0, screenSize.width, 260.0)
        }
    }


    func hidePicker() {
        let screenSize = UIScreen.mainScreen().bounds.size
        UIView.animateWithDuration(0.2) {
            self.frame = CGRectMake(0, self.parentViewHeight(), screenSize.width, 260.0)
        }
    }

