IQTextInputViewNotification

CI Status Version License Platform

Screenshot

示例

要运行示例项目,请克隆 repo,然后首先从 Example 目录运行 pod install

要求

安装

IQTextInputViewNotification 可以通过 CocoaPods 获得。 要安装它,只需将以下行添加到您的 Podfile

pod 'IQTextInputViewNotification'

用法

要观察 textInputView becomeFirstResponder 和 resignFirstResponder 的变化,请订阅 textInputView 事件:-

import IQTextInputViewNotification

class ViewController: UIViewController {

    private let textInputViewObserver: IQTextInputViewNotification = .init()

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)

        // Subscribe
        textInputViewObserver.subscribe(identifier: "YOUR_UNIQUE_IDENTIFIER") {info in
            print(info.event.name) // BeginEditing or EndEditing event
            print(info.textInputView) // TextInputView which begin editing or end editing
            // Write your own logic here based on event
        }
    }

    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)

        // Unsubscribe
        textInputViewObserver.unsubscribe(identifier: "YOUR_UNIQUE_IDENTIFIER")
    }
}

作者

Iftekhar Qurashi hack.iftekhar@gmail.com

流程

Screenshot

许可证

IQTextInputViewNotification 在 MIT 许可证下可用。 有关更多信息,请参见 LICENSE 文件。