SuxiNumberInputView 0.2.1

SuxiNumberInputView 0.2.1

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最后发布2018年10月
SPM支持 SPM

Simon Lin维护。



  • 作者:
  • simon.lin

SuxiNumberInputView

CI Status Version License Platform

示例

要运行示例项目,请克隆仓库,并在 Example 目录中首先运行 pod install

用法

使用SuxiNumberInputView的示例:

let textFieldInputView = SuxiNumberInputView().bindTo(textField: textField)
// This is optional
textFieldInputView?.delegate = self

let textViewInputView = SuxiNumberInputView().bindTo(textView: textView)
// This is optional
textViewInputView?.delegate = self

您的UITextField或UITextView应正常工作。

注意,SuxiNumberInputView在绑定时会自动更改键盘类型为数字键盘。

SuxiNumberInputView进行了非常简单的检查以避免错误的数字格式,目前仅支持浮点数字格式。

SuxiNumberInputViewDelegate提供了信息,以便您可以知道哪个按钮被点击

func suxiNumberInputView(_ inputView: SuxiNumberInputView, pressedKey keyCode: SuxiNumberKeyCode)

SuxiNumberKeyCode枚举

enum SuxiNumberKeyCode {
    case one
    case two
    case three
    case four
    case five
    case six
    case seven
    case eight
    case nine
    case zero
    case dot
    case delete
    case done
}

您可以使用keyCode.value来获取keycode的原始值,删除和完成keycode返回空字符串。

屏幕截图

Screen Shot

要求

iOS 10.0+

安装

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

pod "SuxiNumberInputView"

作者

simon.lin

许可

SuxiNumberInputView 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。