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

        }
        y += kHeightMargin + buttonRect[0].size.height + 10.0
        
        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 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()
