Giter VIP home page Giter VIP logo

mmnumberkeyboard's Introduction

MMNumberKeyboard

A simple keyboard to use with numbers and, optionally, a decimal point.

And it works great on the iPad too

Installation

From CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like MMNumberKeyboard in your projects. First, add the following line to your Podfile:

pod 'MMNumberKeyboard'

Second, install MMNumberKeyboard into your project:

pod install

From Carthage

Carthage is a dependency manager for Objective-C and Swift. Add the following line to your Cartfile:

github "matmartinez/MMNumberKeyboard"

The run carthage update.

Follow the current instructions in Carthage's README for up to date installation instructions.

Usage

There is a sample Xcode project available. Just build & run. And profit.

Basically you instantiate your own keyboard view to use as an .inputView of your UITextField, UITextView or whatever view that supports text editing.

// Create and configure the keyboard.
MMNumberKeyboard *keyboard = [[MMNumberKeyboard alloc] initWithFrame:CGRectZero];
keyboard.allowsDecimalPoint = YES;
keyboard.delegate = self;

// Configure an example UITextField.
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectZero];
textField.inputView = keyboard;

You can adopt the MMNumberKeyboardDelegate protocol to handle the return key or whether text should be inserted or not.

Development

Pull requests are welcome and mostly appreciated.

Credits

Thanks to Pedro Burón for the encouragement and moral support to make this README file possible.

mmnumberkeyboard's People

Contributors

anthonymyatt avatar leberwurstsaft avatar matmartinez avatar mdiep avatar mortengregersen avatar readmecritic avatar rodrigomad 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mmnumberkeyboard's Issues

monitor textfiled output in real time

hi,How to monitor textfiled real-time output? I use MMNumberKeyboard in my project, but seem that do not execute this function

  • (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{

    //
    NSLog(@"%@",textField.text);

    return YES;
    }

if I cancel MMNumberKeyboard as inputview 0f textfiled ?The above function will be executed!
how do I solve it?
thank you sir

Done button title customization

I would like the Done button to read "Search" instead of "Done". The Apple standard set would be nice, although I'm sure people would also love the ability to set custom strings as well, since I know many people already want to customize that button on Apple's own keyboard.

This would also allow for safer localization than the current, potentially dubious mechanism of accessing the com.apple.UIKit bundle's localization table.

First responder <UIView> does not conform to the UIKeyInput protocol.

Recently stopped working due to the error below. This gets called every time a key is pressed, and nothing is added to the textfield on a button press.

First responder <UIView: 0x10aa39320; frame = (0 0; 768 225); layer = <CALayer: 0x281d0a5a0>> does not conform to the UIKeyInput protocol.

Framework doesn't work with Carthage

When running carthage update this error is shown:

*** Skipped building MMNumberKeyboard due to the error:
Dependency "MMNumberKeyboard" has no shared framework schemes

Looking at the Xcode project, there is a demo app target but no framework target and scheme that just builds the keyboard by itself.

TextFieldDelegates not getting called

As I want to limit the text entering to a certain length, I was implementing the -(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string method but somehow I observed it is not getting called for this textfield though the delegate is assigned.

The code for limiting the text to 10 digits is follows:

-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if (textField == textFieldPhone) {
NSString *resultingString = [textField.text stringByReplacingCharactersInRange:range withString:string];
NSInteger length = [resultingString length];
if (length > 10)
return NO;
NSCharacterSet *characterSet = [[NSCharacterSet characterSetWithCharactersInString:ACCEPT_NUMERIC] invertedSet];
NSString *filtered = [[string componentsSeparatedByCharactersInSet:characterSet] componentsJoinedByString:@""];
return [string isEqualToString:filtered];
}
return YES;
}

Thoughts on adding a `-` to the keypad?

Thanks for putting this together Matías!

What are your thoughts on adding support for a - on the keypad? (For my use case I would like for users to be able to enter in negative values.)

Multiple decimal points!

Seems a bit odd to me that you are allowed to enter the decimal point multiple times. I am missing something?

Keyboard always shows in Simulator

In the iOS Simulator, the keyboard always show up, even when set to "Connect Hardware Keyboard".
The same is true when connecting a bluetooth keyboard to a physical iPhone.

It would be nice if this number keyboard only shows up when a software keyboard is needed.

Great library btw, this keyboard is very nice.

UITextFieldDelegate

“- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string” delegate method could not be called

Expose properties to make it more customizable

Hi! I really love this tool, since I knew it I use it over and over, so thanks for it!

The only thing I miss is some lack of customization. For example, if I want to change manually the return button color, or the decimal separator, or other kind of things.

I think it shouldn't be difficult to expose some properties in the header file (the dictionaryButton to have full access to all buttons, for instance) to make it possible.

Do you think this is a good idea? I could prepare a pull request if you want.

Auto-Enabling return key doesn't work with external keyboard

This is kind of a corner case, but related to #7: if you set enablesReturnKeyAutomatically = true, it won't enable if you're entering text with an external keyboard. Of course, you're probably not seeing MMNumberKeyboard if you have an external keyboard anyway, but you could theoretically present it, I think. At least, you can in the simulator. I don't have an iPad with a physical keyboard handy to check, so feel free to close this if I'm just wrong.

how to solve move focus some uitextfield

how to solve move focus some uitextfield

i want process something at begin focus.
ex) previous focus editing done and new focus editing start.

but do noting

how to solve this issue?!

闪退

MMNumberKeyboard.m 执行到 UIKitLocalizedString(@"Done") 崩溃

Thread 1: EXC_BREAKPOINT (code=1, subcode=0x18ff20764)

Allow disabling Done button

The Done button should be able to be disabled, either based on delegate methods, a direct property, or a UITextField-like "auto-enable Return key" mode. In my use case, I'm using MMNumberKeyboard to fill in a single field, and I don't want the Go button to be enabled until the text field is non-empty.

Swift 4.0

Is there any intention to re-write this keyboard for Swift? It looks like an amazing keyboard that I'd like to integrate into my swift product

Floating keyboard on iPad

Hi! Thanks for the great work 👍

I'm using (a fork of) your library in this NativeScript plugin and in a few apps. It works brilliantly.

One of my clients asked whether or not it would be possible to make those grey blocks to the left an right of the keyboard (see the screenshot below) transparent, so it would make the keyboard "float". I've tried a few things myself but couldn't figure out how to do it, so I was hoping anyone here would have a suggestion.

simulator screen shot - ipad pro 9 7 inch - 2017-10-05 at 14 55 46

iOS 12 crash

Hi,

Reporting...
iOS12b3 seems crash at this macro,

@ MMNumberKeyboard.m

#define UIKitLocalizedString(key) [[NSBundle bundleWithIdentifier:@"com.apple.UIKit"] localizedStringForKey:key value:@"" table:nil]

Reproduce-able on device w/iOS12b3 and XCode10b3

Carthage support doesn't work

When building with Carthage I get this error:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_MMTextInputDelegateProxy", referenced from:
      objc-class-ref in MMNumberKeyboard.o
  "_OBJC_CLASS_$_MMKeyboardButton", referenced from:
      objc-class-ref in MMNumberKeyboard.o

Keyboard only works with first UITextField

Hi,

I have multiple numeric textfields. The keyboard works normally with the first field I click on. On the second field pressing any key has no effect. Ie, numbers aren't placed in textfield and I can't lower (hide) the keyboard. This is how I'm setting up the keyboard:

MMNumberKeyboard *keyboardNoDecimal = [[MMNumberKeyboard alloc] initWithFrame:CGRectZero];
keyboardNoDecimal.allowsDecimalPoint = NO;
keyboardNoDecimal.delegate = self;

MMNumberKeyboard *keyboardDecimal = [[MMNumberKeyboard alloc] initWithFrame:CGRectZero];
keyboardDecimal.allowsDecimalPoint = YES;
keyboardDecimal.delegate = self;

self.hundredsCountTextField.inputView = keyboardNoDecimal;
self.fiftiesCountTextField.inputView = keyboardNoDecimal;
self.twentiesCountTextField.inputView = keyboardNoDecimal;
self.tensCountTextField.inputView = keyboardNoDecimal;
self.fivesCountTextField.inputView = keyboardNoDecimal;

self.eodFloatTextField.inputView = keyboardDecimal;
self.coinsTotalTextField.inputView = keyboardDecimal;
self.eftposTotalTextField.inputView = keyboardDecimal;

Am I doing it wrong?

Thanks in advance

Mikey

Testing with Appium

I am currently e2e testing an app that uses this keyboard for several numeric fields. Currently, when I try to have the driver type text into the field I get the following error:

Error: [element.type("4111111111111111")] Error response status: 13, UnknownError - An unknown server-side error occurred while processing the command. Selenium error: An unknown server-side error occurred while processing the command. Original error: Error Domain=com.facebook.WebDriverAgent Code=1 "Keyboard is not present" UserInfo={NSLocalizedDescription=Keyboard is not present}

Is there any fix or workaround for this issue?

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.