DigitalKeyboard
DigitalKeyboard
idcard 的自定义数字键盘
👀 另请参阅
CocoaPods
CocoaPods 是 Cocoa 项目的依赖管理器。您可以使用以下命令安装它
$ gem install cocoapods
构建 IDCardKeyboard 3.0.0+ 需要 CocoaPods 0.39.0+。
要使用 CocoaPods 将 IDCardKeyboard 集成到您的 Xcode 项目中,在您的 Podfile
中指定它
Swift 2.2:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target '<Your Target Name>' do
pod 'IDCardKeyboard', '~> 1.0.8'
end
Swift 2.3
pod 'IDCardKeyboard', :git => 'https://github.com/CNKCQ/DigitalKeyboard.git', :branch => 'Swift2.3'
Swift 3.0:
pod 'IDCardKeyboard', '1.2.6'
Swift 4.0:
pod 'DigitalKeyboard'
然后,运行以下命令
$ pod install
Carthage
github "CNKCQ/DigitalKeyboard"
📖 用法
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
view.backgroundColor = UIColor.orange
let textField = UITextField(frame: CGRect(x: 100, y: 120, width: 200, height: 35))
textField.borderStyle = .roundedRect
view.addSubview(textField)
let keyboard = DigitalKeyboard(view: view)
keyboard.style = .Number
keyboard.customDoneButton(title: "hello", titleColor: UIColor.blue, theme: UIColor.green)
textField.inputView = keyboard
textField.becomeFirstResponder()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}