     
     override func viewDidLayoutSubviews() {
         super.viewWillLayoutSubviews()
-        let size = UIScreen.mainScreen().bounds.size
+        let size = self.screenSize()
         self.viewWidth = size.width
         self.viewHeight = size.height
         

        }
        var textColor = self.darkTextColor
        
        let sz = UIScreen.mainScreen().bounds.size
        self.viewWidth = sz.width
        self.viewHeight = sz.height
        
        // Container for the entire alert modal contents
        self.containerView = UIView()

    
    func closeView(withCallback:Bool) {
        UIView.animateWithDuration(0.3, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.5, options: nil, animations: {
            self.containerView.center.y = self.view.center.y + self.viewHeight!
            }, completion: { finished in
                UIView.animateWithDuration(0.1, animations: {
                    self.view.alpha = 0
