             })
             self.currentKeyboardHeight = 0;
         }
-        notificationCenter.removeObserver(self, name: Notification.Name.UIKeyboardWillChangeFrame, object: nil)
-        notificationCenter.addObserver(self, selector: .keyboardWillShow, name: Notification.Name.UIKeyboardWillShow, object: nil)
+        keyboardStatus = .hidden
     }
+    
     fileprivate func updateForKeyboard(withNotification notification:Notification) {
         if (enabled) {
             let userInfo = notification.userInfo!

        notificationCenter.removeObserver(self)
    }
    
    /**
     *  临时启用或关闭管理器
     */
    var enabled = true
    
    /**
     *  是否与键盘同时执行调整动画，默认为 YES。设置为 NO 后，将会在键盘显示之后再执行动画。
     */
    var animateAlongwithKeyboard = true
    
    fileprivate let notificationCenter = NotificationCenter.default

    
    // MARK: - Private Logics
    fileprivate func registerKeyboardEvents()
    {
        notificationCenter.addObserver(self, selector: .keyboardWillShow, name: Notification.Name.UIKeyboardWillShow, object: nil)
        notificationCenter.addObserver(self, selector: .keyboardDidShow, name: Notification.Name.UIKeyboardDidShow, object: nil)
        notificationCenter.addObserver(self, selector: .keyboardWillHide, name: Notification.Name.UIKeyboardWillHide, object: nil)
    }
    
    fileprivate func viewBottomSpace() -> CGFloat
    {
        var bottomOffSet:CGFloat = 0
        
        if let scrollView = self.viewToAdjust as? UIScrollView {
            bottomOffSet = scrollView.contentInset.bottom
            bottomOffSet = max(0, bottomOffSet)
        }
        
        return self.viewController.view.frame.size.height - self.viewToAdjust.frame.size.height - self.viewToAdjust.frame.origin.y + bottomOffSet;
    }

    
    @objc internal func keyboardWillShow(_ notification:Notification) {
        self.originalBottomSpace = viewBottomSpace();
        
        if (self.animateAlongwithKeyboard) {
            updateForKeyboard(withNotification: notification)
        }
        notificationCenter.removeObserver(self, name: Notification.Name.UIKeyboardWillShow, object: self)
    }
    @objc internal func keyboardDidShow(_ notification:Notification) {
        updateForKeyboard(withNotification: notification)
        notificationCenter.addObserver(self, selector: .keyboardWillChangeFrame, name: Notification.Name.UIKeyboardWillChangeFrame, object: nil)
    }
    @objc internal func keyboardWillChangeFrame(_ notification:Notification) {
        updateForKeyboard(withNotification: notification)
    }
    @objc internal func keyboardWillHide(_ notification:Notification) {
        if (enabled) {
            let userInfo = notification.userInfo!
            let timeInterval = (userInfo[UIKeyboardAnimationDurationUserInfoKey] as! NSNumber).doubleValue

    fileprivate var originalConstant:CGFloat
    fileprivate var originalBottomSpace:CGFloat = 0
    fileprivate var currentKeyboardHeight:CGFloat = 0

    init(withViewController viewController:UIViewController, positionConstraint:NSLayoutConstraint, viewToAdjust:UIView) {
        self.viewController = viewController
        self.viewToAdjust = viewToAdjust
