Code Monkey home page Code Monkey logo

scnumberkeyboard's Introduction

SCNumberKeyBoard

  • A Money Number KeyBoard Like AliPay Money Number KeyBoard.
  • You can use code, xib and storyboard.

Installation

Use the CocoaPods.

In your Podfile

pod 'SCNumberKeyBoard'

Get SCNumberKeyBoard

#import "SCNumberKeyBoard.h"

Or

Drag SCNumberKeyBoardDemo/Classes and SCNumberKeyBoardDemo/Resources/ folder into your project

#import "SCNumberKeyBoard.h"

Previews

How To Use

[SCNumberKeyBoard showOnViewController:<#viewController#> enterButtonTitle:nil enter:^(UITextField *textField, NSString *number) {
        NSLog(@"textField:%@ - number:%@", textField, number);
    } close:^(UITextField *textField, NSString *number) {
        NSLog(@"textField:%@ - number:%@", textField, number);
}];

Or

[SCNumberKeyBoard showWithTextField:<#textField#> enter:^(UITextField *textField, NSString *number) {
        NSLog(@"textField:%@ - number:%@", textField, number);
    } close:^(UITextField *textField, NSString *number) {
        NSLog(@"textField:%@ - number:%@", textField, number);
}];

Localization

Localization include Chinese and English, you can add other by yourself. Change localization you should edit Info.plist.

Use localization that you should change iOS system language.


金额输入键盘

  • 可以同时在代码和Xib以及Storyboard中使用。
  • 只需要简单一句代码即可搞定麻烦的金额输入控制。

如何使用SCNumberKeyBoard

Cocoapods:

  • cocoapods导入:pod 'SCNumberKeyBoard'

手动导入:

  • SCNumberKeyBoardDemo/ClassesSCNumberKeyBoardDemo/Resources/文件夹中的所有文件拽入项目中
  • 导入主头文件:#import "SCNumberKeyBoard.h"

效果图

加入代码

[SCNumberKeyBoard showOnViewController:<#viewController#> enterButtonTitle:nil enter:^(UITextField *textField, NSString *number) {
        NSLog(@"textField:%@ - number:%@", textField, number);
    } close:^(UITextField *textField, NSString *number) {
        NSLog(@"textField:%@ - number:%@", textField, number);
}];

或者

[SCNumberKeyBoard showWithTextField:<#textField#> enter:^(UITextField *textField, NSString *number) {
        NSLog(@"textField:%@ - number:%@", textField, number);
    } close:^(UITextField *textField, NSString *number) {
        NSLog(@"textField:%@ - number:%@", textField, number);
}];

本地化

本地化只包含了中文和英文,其他语言自行添加。

使用本地化,改变iOS系统语言即可。

scnumberkeyboard's People

Contributors

rockerhx 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scnumberkeyboard's Issues

Multiple textfields

Could I assign this to multiple textfields on a screen and have it appear based on a user selecting a field rather than invoking it myself ?

#UITextField delegate method not called normal

使用了
[SCNumberKeyBoard showWithTextField:self.inputMoney enter:^(UITextField *textField, NSString *number) {
NSLog(@"textField:%@ - number:%@", textField, number);
if ([self.inputMoney.text floatValue] > [self.moneyMax.text floatValue]) {
NSLog(@"数额大了");
}
} close:^(UITextField *textField, NSString *number) {
NSLog(@"textField:%@ - number:%@", textField, number);
}];

方法来添加后,发现UITextField的delegate方法:

  • (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{}
    不能被正常调用了。

#question Is there any way to confirm value when hide keyboard without press done

Hi:
It's definite great work and I use it very well on my app.
Appreciate your elegant code.
However, I would like to ask if there is any way to let me know when the keyboard is hide from screen,
since original textfield delegate looks like not work.
I just want to let user can input a value and confirm it without press done button.
Thanks.

textfield text 错误

每次点了确定键盘隐藏,紧接着再点textfield继续输入,为什么上次输入的内容还在,即使把textfield设置内容设置为空,如果在Block里面把返回的textfield设置为空,那么textfield输入的内容就再也不会显示

#crash running in bundlePath error and missing file include who unuse CocoaPods

将SCNumberKeyBoardDemo/Classes文件夹中的所有文件拽入项目中
导入主头文件:#import "SCNumberKeyBoard.h"

Issues 1:
前面的只是针对CocoaPods的导入。
上面列出的“将SCNumberKeyBoardDemo/Classes文件夹中的所有文件拽入项目中”
我按照你的步骤来做,却crash了。
最后找到了原因是:你的xib文件在另外一个名为SCNumberKeyBoard的文件夹。不在class里面。

Issues 2:
导入两个进去后,发现还是crash。
经过断点调试,找到了原因来自:

// Init keyboard view by xib
NSURL *bundleURL = [[NSBundle mainBundle] URLForResource:@"SCNumberKeyBoard" withExtension:@"bundle"];
NSBundle *bundle = [NSBundle bundleWithURL:bundleURL];
self = [[bundle loadNibNamed:@"SCNumberKeyBoard" owner:self options:nil] firstObject];

修改为:
// Init keyboard view by xib
NSBundle *bundle = [NSBundle mainBundle];
self = [[bundle loadNibNamed:@"SCNumberKeyBoard" owner:self options:nil] firstObject];

后方可正常使用。

Last:
建议将所有有用的包都放一个地方。因为有的项目并不使用CocoaPods,需要手动导入。如果不放统一包里面,又没有说明,会有问题。其次那个路径问题应该也是导致的。

最后来一句:支持国产!

SCNumberKeyBoard

为什么点击确定之后隐藏键盘后又会自动弹出键盘,挺严重的bug,
而且不易于扩展,小数点前面应该动态的可以限制

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.