Gatti 0.1.2

Gatti 0.1.2

Dmitriy Zhyzhko 维护。



Gatti 0.1.2

  • z-four

Version License Platform

它是什么?

Gatti 是一个用于优雅地在文本字段之间移动光标的库。它特别适用于更好的用户交互,如身份验证屏幕。

以下是如何转换您的屏幕的快速示例!

外观

库具有默认外观。因此,当您没有指定速度或颜色属性时,Gatti 将使用默认值。

默认值

  • speed: TimeInterval
    • 默认: 0.55
  • color: UIColor?
    • 默认: .none (默认情况下为文本字段的 tintColor)

如何使用

 override func viewDidLoad() {
     super.viewDidLoad()
    
     // Attach cursor to the UIViewController
     Gatti.attach(to: self)
     
     // Attach cursor with delegate
     Gatti.attach(to: self, delegate: self)
     
     // Attach cursor only for some fields
     Gatti.attach(to: self, textFields: [UITextField])
     
     // Update cursor moving speed and set defaule color for all the text fields
     Gatti.update(to: self, speed: 0.8, color: .red)
     
     ...
     
     // Detach cursor from the screen
     Gatti.detach(from: self)
 }

代理

extension ViewController: UITextFieldDelegate, UITextFieldCaretDelegate {
    
    func caretWillAttach(to textField: UITextField) {
        // Will attach to the UITextField
    }
    
    func caretDidDetach(from textField: UITextField) {
        // Did detach from the UITextField
    }
   
    func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
        // Handle UITextField delegate methods
        return true
    }
}

需求

  • iOS 10.0+
  • CocoaPods 1.0.0+
  • Swift 5

安装

库通过 CocoaPods 提供。编辑您的 Podfile 并指定依赖

pod "Gatti"

许可协议

MIT 许可协议

版权所有 (c) 2019 Dmitriy Zhyzhko

在此特此授予任何人无限制地使用本软件及其相关文档文件(统称为“软件”)的权利,不受任何限制,包括且不限于使用、复制、修改、合并、发布、分发、再许可和/或销售软件副本的权利,并允许获得软件的人接受上述装备的软件进行操作,前提是遵守以下条件

上述版权声明及本许可声明应包含在软件的所有副本或主要部分中。

本软件按照“现状”提供,不提供任何形式的保证,无论是明示的还是隐含的,包括但不限于适销性、特定用途适用性和非侵权性保证。在任何情况下,作者或版权所有者不对任何索赔、损害或其他责任承担责任,这些责任可能源自合同、侵权或其他方式,与软件或其使用(或与其有关)有关。