         }
         y += kHeightMargin + buttonRect[0].size.height + 10.0
         
+        if y > kMaxHeight {
+            let diff = y - kMaxHeight
+            let sFrame = subTitleTextView.frame
+            subTitleTextView.frame = CGRect(x: sFrame.origin.x, y: sFrame.origin.y, width: sFrame.width, height: sFrame.height - diff)
+            
+            for button in buttons {
+                let bFrame = button.frame
+                button.frame = CGRect(x: bFrame.origin.x, y: bFrame.origin.y - diff, width: bFrame.width, height: bFrame.height)
+            }
+            
+            y = kMaxHeight
+        }
         contentView.frame = CGRect(x: (mainScreenBounds.size.width - kContentWidth) / 2.0, y: (mainScreenBounds.size.height - y) / 2.0, width: kContentWidth, height: y)
         contentView.clipsToBounds = true
     }

        
    }
    
    func setupContentView() {
        
        contentView.backgroundColor = UIColor(white: 1.0, alpha: 1.0)

    func showAlert(title: String, subTitle: String?, style: AlertStyle,buttonTitle: String,buttonColor: UIColor,otherButtonTitle:
        String?, otherButtonColor: UIColor?,action: ((isOtherButton: Bool) -> Void)? = nil) {
            userAction = action
            let window = UIApplication.sharedApplication().keyWindow?.subviews.first as! UIView
            window.addSubview(view)
            view.frame = window.bounds
            self.setupContentView()
            self.setupTitleLabel()
            self.setupSubtitleTextView()
