测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可 | MIT |
发布最后发布 | Nov 2016 |
SPM支持 SPM | ✗ |
Maintained by cztatsumi-keisuke, cokaholic.
TKKeyboardControl 为任何视图添加键盘感知和滚动消失功能(如 iMessages 应用),仅需一行代码 for Swift3.0.
此库受 DAKeyboardControl 的启发。
将 TKKeyboardControl 目录添加到您的项目中。
包含示例项目(./Example)
self.view.addKeyboardPanningWithFrameBasedActionHandler({ (keyboardFrameInView, opening, closing) in
// Move interface objects accordingly
// Animation block is handled for you
}, constraintBasedActionHandler: nil)
// Make sure to call self.view.removeKeyboardControl before the view is released.
// (It's the balancing call)
self.view.addKeyboardNonpanningWithFrameBasedActionHandler({ (keyboardFrameInView, opening, closing) in
// Move interface objects accordingly
// Animation block is handled for you
}, constraintBasedActionHandler: nil)
// Make sure to call self.view.removeKeyboardControl before the view is released.
// (It's the balancing call)
通过 keyboardTriggerOffset
属性,您可以选择用户的手指何时“接触”键盘。
self.view.keyboardTriggerOffset = 44.0; // Input view frame height
self.view.addKeyboardPanningWithFrameBasedActionHandler({ (keyboardFrameInView, opening, closing) in
// Move interface objects accordingly
// Animation block is handled for you
}, constraintBasedActionHandler: nil)
// Make sure to call self.view.removeKeyboardControl before the view is released.
// (It's the balancing call)
self.view.hideKeyboard()
self.view.removeKeyboardControl()
TKKeyboardControl
默认启用 ARC。
cztatsumi-keisuke,[邮箱地址隐藏]
TKKeyboardControl 在 MIT 许可证下可用。
版权所有 © 2016 Keisuke Tatsumi
特此免费授予任何获得本软件和相关文档副本(以下简称“软件”)的人在任何限制下处理软件的权利,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或销售软件副本的权利,并授予软件的使用者根据以下条件进行操作的权利
上述版权声明和本许可声明应包含在软件的任何副本或大部分内容中。
软件按“原样”提供,不受任何明示或暗示的保证,包括但不限于适销性、针对特定目的的适用性和非侵权性保证。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任承担义务,无论此类索赔、损害或其他责任是由于合同的违反、侵权或其他行为引起的,无论是与软件、软件的使用或与软件相关的任何活动有关或产生,或因使用或其他处理软件而引起。