KeyboardNotificationsObserver 0.2.0

KeyboardNotificationsObserver 0.2.0

Aleksey Kuznetsov 维护。



  • Aleksey Kuznetsov

KeyboardNotificationsObserver

Build Status Cocoapod

一个用于 UIKeyboard 通知的观察者,提供安全便捷的接口。

Demo

使用方法

  • 导入模块
import KeyboardNotificationsObserver
  • 创建 KeyboardNotificationsObserver 实例作为属性(例如在视图控制器中)
private let keyboardObserver = KeyboardNotificationsObserver()
  • 实现必要的回调
override func viewDidLoad() {
    super.viewDidLoad()
    keyboardObserver.onWillShow = { [weak self] info in
        // Change a view according to keyboard size.
    }
}

所有六个 UIKeyboard 通知都已实现。您可以使用以下回调: onWillShowonDidShowonWillHideonDidHideonWillChangeFrameonDidChangeFrame

需求

  • iOS 9.0 或更高版本
  • Xcode 10 (swift 5.0) 或更高版本

变更

查看 变更日志

安装

CocoaPods

KeyboardNotificationsObserver 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile

pod 'KeyboardNotificationsObserver'

手动

只需将 KeyboardNotificationsObserver.swift 文件拖放到您的项目中。就这样!

许可协议

KeyboardNotificationsObserver 根据 MIT 许可协议提供。更多信息请见 LICENSE 文件。