keyboard show hide notification

GitHub

引入

pod PPFKeyboardNotification

使用

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
   PPFKeyboardNotification.share.addObserver()
    PPFKeyboardNotification.share.delegate = self
}
override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    PPFKeyboardNotification.share.removeObserver()
}
// MARK: - PPFKeyboardNotification_delegate
extension ViewController:PPFKeyboardNotification_delegate {
    func keyboardWillShowWithModul(modul: PPFKeyboardNotification, rect: CGRect, duration: Double, animationOption: UIView.AnimationOptions) {
       print("键盘将要显示")
    }
    
    func keyboardWillHideWithModul(modul: PPFKeyboardNotification, rect: CGRect, duration: Double, animationOption: UIView.AnimationOptions) {
        print("键盘将要隐藏")
    }
}

你可能感兴趣的:(keyboard show hide notification)