title: How to update uiview size when orientation is changed?
body: <p>The view loads with a height of 324 pixels. Then view updates its height to 250 pixels when I turn the device landscape, but after I turn the device from landscape to portrait it doesn't reset the height of the view back to 324 pixels.</p>
  
  <pre><code>  import UIKit
  
  class KeyboardViewController: UIInputViewController {
  var calcBoard = CalcControl()
  var disNum:Double = 0.0
  var expandedHeight:CGFloat = 250
  
  
  override func updateViewConstraints() {
      super.updateViewConstraints()
  
             // Add custom view sizing constraints here
  }
  override func willRotateToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) {
  
      //self.view.addConstraint(heightconstraints2)
      var heightconstraints3:NSLayoutConstraint = NSLayoutConstraint(item: self.view, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 0.0, constant: self.expandedHeight)
      //self.view.addConstraint(heightconstraints2)
      if toInterfaceOrientation == UIInterfaceOrientation.LandscapeLeft{
  
              self.expandedHeight = 250
  
  
          self.view.addConstraint(heightconstraints3)      }
      if toInterfaceOrientation == UIInterfaceOrientation.LandscapeRight{
  
              self.expandedHeight = 250
  
  
          self.view.addConstraint(heightconstraints3)
      }
      if toInterfaceOrientation == UIInterfaceOrientation.Portrait{
          println("In portrait")
                        println("Transforming")
              self.expandedHeight = 324
  
  
          self.view.addConstraint(heightconstraints3)
      }
  
  
  
  
  
  
  }
  override func didRotateFromInterfaceOrientation(fromInterfaceOrientation: UIInterfaceOrientation) {
      if fromInterfaceOrientation == UIInterfaceOrientation.Portrait{
          println("Adjusting...")
          self.expandedHeight = 324
      }
  }
  override func viewDidLoad() {
      super.viewDidLoad()
      println("Loaded")
  
  
      NSNotificationCenter.defaultCenter().addObserver(self, selector: "LoadNumber:", name: "load", object: nil)
      self.deleteBackward()
      // Perform custom UI setup here
      //self.calcBoard.frame = CGRect(x: 123, y: 0, width: 320, height: 324)
  
      var xibView1 = NSBundle.mainBundle().loadNibNamed("CalcView", owner: nil, options: nil)
  
      self.calcBoard = xibView1[0] as CalcControl
      self.view.frame = CGRect(x: 0, y: 0, width: 320, height: 324)
  
      self.view.addSubview(calcBoard)
  
  }
  
  func LoadNumber(notification:NSNotification){
      println("got it")
      var num = (calcBoard.number as NSNumber).stringValue
      println(num)
      var proxy = textDocumentProxy as UITextDocumentProxy
      proxy.insertText(num)
  }
  func recieveNumberfromSource()-&gt;Double{
  
      return self.disNum
  }
     func deleteBackward(){
  
  }
  func hasText() -&gt; Bool{
      return true
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated
  }
  
  override func textWillChange(textInput: UITextInput) {
      // The app is about to change the document's contents. Perform any preparation here.
  }
  
  override func textDidChange(textInput: UITextInput) {
      // The app has just changed the document's contents, the document context has been updated.
  
      var textColor: UIColor
      var proxy = self.textDocumentProxy as UITextDocumentProxy
      if proxy.keyboardAppearance == UIKeyboardAppearance.Dark {
          textColor = UIColor.whiteColor()
      } else {
          textColor = UIColor.blackColor()
      }
  
  }
  override func viewDidAppear(animated: Bool) {
      //self.updateViewConstraints()
      var expandedHeight:CGFloat = 324
      var heightconstraint:NSLayoutConstraint = NSLayoutConstraint(item: self.view, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 0.0, constant: expandedHeight)
      self.view.addConstraint(heightconstraint)
  
  }
  }
  </code></pre>