Keynode 4.0.0

Keynode 4.0.0

测试测试
语言语言 SwiftSwift
许可证 MIT
发布上次发布2018 年 9 月
SPM支持 SPM

Kyohei Ito 维护。



Keynode 4.0.0

  • Kyohei Ito

Keynode

Carthage compatible Version License Platform

为什么

使用在 iOS7 中添加的 UIScrollViewKeyboardDismissMode,交互式键盘操作成为可能。但,它只能在 UIScrollView 中工作。

Keynode 能够交互操作所有作为 FirstResponder 出现的 inputView

Appetize 的演示

UITextField UITextField UIPickerView
UIPickerView UITextField UITextField

要求

  • Swift 4.2
  • iOS 9.0 或更新版本

如何安装

CocoaPods

将以下内容添加到您的 Podfile

pod "Keynode"

Carthage

将以下内容添加到您的 Cartfile

github "KyoheiG3/Keynode"

用法

函数

func willAnimate(_ handler: @escaping (Bool, CGRect) -> Swift.Void) -> Keynode.Keynode
  • 动画开始前调用。
func animations(_ handler: @escaping (Bool, CGRect) -> Swift.Void) -> Keynode.Keynode
  • 在显示开关动画时调用。
  • 在滚动手势的键盘操作时也调用。
func onCompleted(_ handler: @escaping (Bool, UIResponder?, UIView?) -> Swift.Void) -> Keynode.Keynode
  • 在动画结束时调用。
func setResponder(responder: UIResponder)
  • 可以设置响应者。

变量

var isGesturePanningEnabled: Bool
  • 如果您不需要使用滚动手势来移动键盘,则设置为 false
  • 默认为 true
var needsToChangeInsetAutomatically: Bool
  • 如果您不需要在键盘打开时更改 UIScrollView 的内容内边距,则设置为 false
  • 默认为 true
var defaultInsetBottom: CGFloat
  • 如需更改,请更改 contentInset 的底部。
  • 默认为 0
var gestureOffset: CGFloat
  • 例如,当有 toolbar 时,您可以指定使用滚动手势关闭键盘时的偏移量。
  • 如果未设置值,将使用在defaultInsetBottom中指定的值。

扩展

extension NSNotification.Name {
    static let UIResponderBecomeFirstResponder: Notification.Name
}
  • 成为第一响应者的通知名称。
extension UIApplication {
    func needsNotificationFromFirstResponder(_ from: Swift.AnyObject?)
}
  • 在执行函数时接收第一响应者的通知。

注意

  • 如果规范已更改,可能无法正常工作。然而,它将在最早可能的时间得到解决。
  • iOS9.0 ~ iOS12.0已确认可操作。

鸣谢

作者

Kyohei Ito

关注我🎉

授权协议

遵循MIT授权协议。请参阅LICENSE文件以获取详细说明。