A custom digital keyboard for idcard
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
CocoaPods 0.39.0+ is required to build IDCardKeyboard 3.0.0+.
To integrate IDCardKeyboard into your Xcode project using CocoaPods, specify it in your 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'
Then, run the following command:
$ pod install
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.
}
}
🔑 Basics Swift 2.2、Swift 3.0、Swift4.0