title: Move textfield when keyboard appears swift
body: <p>I'm using Swift for programing with iOS and I'm using this code to move the <code>UITextField</code>, but it does not work. I call the function <code>keyboardWillShow</code> correctly, but the textfield doesn't move. I'm using autolayout.</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
      NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillShow:"), name:UIKeyboardWillShowNotification, object: nil);
      NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillHide:"), name:UIKeyboardWillHideNotification, object: nil);
  }
  
  deinit {
      NSNotificationCenter.defaultCenter().removeObserver(self);
  }
  
  func keyboardWillShow(notification: NSNotification) {
      if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() {
          //let contentInsets = UIEdgeInsets(top: 0, left: 0, bottom: keyboardSize.height, right: 0)
  
          var frame = self.ChatField.frame
          frame.origin.y = frame.origin.y - keyboardSize.height + 167
          self.chatField.frame = frame
          println("asdasd")
      }
  }
  </code></pre>