GithubHelp home page GithubHelp logo

parkingwang / vehicle-keyboard-ios Goto Github PK

View Code? Open in Web Editor NEW
121.0 6.0 32.0 1.26 MB

停车王车牌号码专用键盘 - iOS

License: Other

Ruby 1.43% Objective-C 6.54% Swift 91.87% C 0.16%
parkingwang ios ios-swift keyboard

vehicle-keyboard-ios's Introduction

停车王车牌号码专用键盘 VehicleKeyboard - iOS

概述

  • 停车王车牌号码专用键盘ios版,支持新能源、武警、领事馆等多项专用格式车牌。
  • 代码为swift编写,已支持oc调用,可以绑定UIview使用格子输入或绑定UItextfield输入,键盘与系统键盘用法类似。

demo需要pod install一下才能运行

gif gif

如何使用

使用cocoaPods导入

在podfile中添加

use_frameworks!

pod 'VehicleKeyboard-swift',

然后pod install一下

OC调用

oc引用pod中的库

#import "VehicleKeyboard_swift-Swift.h"

直接作为inputView使用

[self.myTextField changeToPlatePWKeyBoardInpurView];

//一些键盘事件的监听方法
self.myTextField.plateChange = ^(NSString *text,BOOL complete) {
    NSLog(@"系统框车牌发生变化:%@\n是否输入完成:%@",text,complete ? @"" : @"");
};

self.myTextField.pwKeyBoardShow = ^{
    NSLog(@"系统框车牌键盘显示");
};

self.myTextField.pwKeyBoardHidden = ^{
    NSLog(@"系统框车牌键盘隐藏");
};

直接作为inputView使用时,回调于取值都与系统方法一直,直接当做系统UItextfield使用即可

格子式车牌专用输入框调用

首先在需要显示的位置摆放一个刚实例化的UIView, 然后创建一个PWHandler对象将UIView于格子车牌输入框进行绑定

@property (strong,nonatomic) PWHandler *handler;
@property (weak, nonatomic) IBOutlet UIView *plateInputView;

self.handler = [PWHandler new];
//改变主题色
self.handler.mainColor = [UIColor redColor];
//改变文字大小
self.handler.textFontSize = 18;
//改变文字颜色
self.handler.textColor = [UIColor greenColor];

[self.handler setKeyBoardViewWithView:self.plateInputView];

self.handler.delegate = self;

格子输入框的各种回调方法

//车牌输入发生变化时的回调
- (void)palteDidChnageWithPlate:(NSString *)plate complete:(BOOL)complete{
NSLog(@"输入车牌号为:%@ \n 是否完整:%@",plate,complete ? @"完整" : @"不完整");
}

//输入完成点击确定后的回调
- (void)plateInputCompleteWithPlate:(NSString *)plate{
NSLog(@"输入完成。车牌号为:%@",plate);
}

//车牌键盘出现的回调
- (void)plateKeyBoardShow{
NSLog(@"键盘显示了");
}

//车牌键盘消失的回调
- (void) plateKeyBoardHidden{
NSLog(@"键盘隐藏了");
}

Swift调用

引用pod中的库

import VehicleKeyboard_swift

直接作为inputView使用

myTextField.changeToPlatePWKeyBoardInpurView()

//监听键盘的改变
myTextField.plateChange = { (text,complete) in
    print("系统输入框键盘改变了text:\(text)\n是否完成车牌输入:\(complete ? "" : "")")
}

myTextField.pwKeyBoardShow = {
   print("系统框车牌键盘显示了")
}

myTextField.pwKeyBoardHidden = {
   print("系统框车牌键盘隐藏了")
}

直接作为inputView使用时,回调于取值都与系统方法一直,直接当做系统UItextfield使用即可

格子式车牌专用输入框调用

首先在需要显示的位置摆放一个刚实例化的UIView, 然后创建一个PWHandler对象将UIView于格子车牌输入框进行绑定

let handler = PWHandler()
@IBOutlet weak var plateInputVIew: UIView!

handler.delegate = self
//改变主题色
handler.mainColor = UIColor.red
//改变字体大小
handler.textFontSize = 18
//改变字体颜色
handler.textColor = UIColor.blue

handler.setKeyBoardView(view: plateInputVIew)

格子输入框的各种回调方法

//输入完成点击确定后的回调
func plateInputComplete(plate: String) {
print("输入完成车牌号为:" + plate)
}
//车牌输入发生变化时的回调
func palteDidChnage(plate:String,complete:Bool) {
print("输入车牌号为:" + plate + "\n输入是否完整?:" + (complete ? "完整" : "不完整"))
}
//车牌键盘出现的回调
func plateKeyBoardShow() {
print("车牌键盘显示")
}
//车牌键盘消失的回调
func plateKeyBoardHidden() {
print("车牌键盘隐藏")
}

主要类的介绍

详细属性介绍请看注释

  • PWKeyboardView:核心类,主要实现键盘逻辑与布局;
  • PWHandler:自定义输入框的核心类,主要实现输入框逻辑,若使用者希望更好的调整布局,可继承此类重写layout的代理方法;
  • Engine:键盘逻辑的核心类,实现键位的布局和注册。

注意

  • 在podfile中没有use_frameworks!这句指令的话,请加上,加上之后导入方式会有变化,请百度。
  • 直接作为inputView使用时,当输入长度超过车牌规定长度时,会默认更新最后一位输入内容
  • 键盘除了主题色外,其他样式暂不支持修改

支持

VehicleKeyboard是停车王品牌的各端产品线的基础组件,专为提高**车牌号码输入速度而定制开发的专用键盘组件,包括以下三个项目:

可能的Q&A

  • Q: pod intall的时候失败提示找不到这个库?
  • A: pod其实是找的本地缓存目录,新上传的库可能出现找不到的情况,删除本地的~/Library/Caches/CocoaPods/search_index.json 缓存目录,用pod repo update master这个命令更新了本地的索引库,再pod install 试试。
  • Q: 编译报错:xxx.nib This target might include its own product或是引用头文件时一直not find
  • A: 在podfile中加上use_frameworks!变更引用方式,加上之后 导入方式要变 例如 #import"SVProgressHUD.h" 改为 #import <SVProgressHUD/SVProgressHUD.h>
  • Q: 我设置了一些ui参数,但是实际显示和设置又些出入?
  • A: 请在设置各种ui参数后再调用setKeyBoardView方法。

vehicle-keyboard-ios's People

Contributors

shang1219178163 avatar yzhtracy avatar z-wade avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

vehicle-keyboard-ios's Issues

textField不走代理

textfield放在uitableViewCell上面 不用这个键盘的话会走textField的代理方法,如果用了就不走了

全面屏底部间距调整

在全面屏上底部间距没有让出来安全区域的距离,太贴底了,能调整弹出键盘距底部的间距吗?

使用Swift版本后模拟器iOS10一下编译通过但是运行崩溃(iOS10+编译运行都没问题),以前使用的OC 版本没问题,项目本身也是OC 项目

dyld: Library not loaded: /usr/lib/libauto.dylib
Referenced from: /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
Reason: no suitable image found. Did find:
/usr/lib/libauto.dylib: mach-o, but not built for iOS simulator
(lldb)

不使用Swfit 版本的这个键盘库就没问题,不知道是不是Swift使用到了什么系统库,

建议

能翻译个OC版的吗,不想cocoapod整体都变成framework的链接形式

你好 ios三方有报错

Swift PWHandler() 初始化报错

Trapped uncaught exception 'NSUnknownKeyException', reason: '[<UIView 0x119fcc030> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key backgroundImageView.'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.