title: UIKeyboardWillShowNotification called twice if screen rotates
body: <p>I create notifications when the keyboard appears and disappears.</p>
  
  <pre><code>override func viewDidLoad() {
  
      super.viewDidLoad()
  
      // Creates notification when keyboard appears and disappears
      NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillShow:"), name: UIKeyboardWillShowNotification, object: nil)
      NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillHide:"), name: UIKeyboardWillHideNotification, object: nil)
  
  }
  
  override func viewWillDisappear(animated: Bool) {
  
      NSNotificationCenter.defaultCenter().removeObserver(self, name: UIKeyboardWillShowNotification, object: nil)
      NSNotificationCenter.defaultCenter().removeObserver(self, name: UIKeyboardWillHideNotification, object: nil)
  
  }
  
  func keyboardWillShow(notification: NSNotification) {
  
      self.adjustingHeight(true, notification: notification)
  
  }
  
  func keyboardWillHide(notification: NSNotification) {
  
      self.adjustingHeight(false, notification: notification)
  
  }
  
  private func adjustingHeight(show: Bool, notification: NSNotification) {
  
      // Gets notification information in an dictionary
      var userInfo = notification.userInfo!
      // From information dictionary gets keyboard’s size
      let keyboardFrame:CGRect = (userInfo[UIKeyboardFrameBeginUserInfoKey] as! NSValue).CGRectValue()
      // Gets the time required for keyboard pop up animation
      let animationDurarion = userInfo[UIKeyboardAnimationDurationUserInfoKey] as! NSTimeInterval
      // Animation moving constraint at same speed of moving keyboard &amp; change bottom constraint accordingly.
      if !(show &amp;&amp; self.bottomConstraint.constant != self.bottomConstraintConstantDefault) {
          if show {
              self.bottomConstraint.constant = (CGRectGetHeight(keyboardFrame) + self.bottomConstraintConstantDefault / 2)
          } else {
              self.bottomConstraint.constant = self.bottomConstraintConstantDefault
          }
          UIView.animateWithDuration(animationDurarion) {
              self.view.layoutIfNeeded()
          }
      }
  
      self.hideLogoIfSmall()
  
  }
  </code></pre>
  
  <p>The strange behaviour occurs when the keyboard is already shown and I rotate the screen. Then the next actions occurs:</p>
  
  <ol>
  <li>UIKeyboardWillHideNotification called</li>
  <li>UIKeyboardWillShowNotification called (with the old height of the keyboard)</li>
  <li>UIKeyboardWillShowNotification called (with the new height of the keyboard)</li>
  </ol>
  
  <p>The result of this is that my view is not updated properly because the first time UIKeyboardWillShowNotification is called I receive a different height of the keyboard than the second time.</p>