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

Overview

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.

Comments
  • Thoughts on adding a `-` to the keypad?

    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.)

    opened by emmceemoore 7
  • Delegate method does not provide the range of the text that will be inserted

    Delegate method does not provide the range of the text that will be inserted

    There is no range information provided on delegate method. - (BOOL)numberKeyboard:(MMNumberKeyboard *)numberKeyboard shouldInsertText:(NSString *)text Every number is being added to the end of the text.

    opened by gunesmert 6
  • Allow disabling Done button

    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.

    opened by ZevEisenberg 6
  • TextFieldDelegates not getting called

    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; }

    opened by ghost 5
  • Fixed button styling not being applied

    Fixed button styling not being applied

    The return key button did not fully apply the new style. Only the text color was applied but not the background color.

    Until now the background color update only happened after tapping the button (when -setHighlighted was called).

    opened by leberwurstsaft 4
  • Done button title customization

    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.

    opened by ZevEisenberg 4
  • Framework doesn't work with Carthage

    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.

    opened by Vortec4800 3
  • how to solve move focus some uitextfield

    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?!

    opened by hyuni 3
  • iOS 12 crash

    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

    opened by dklt 2
  • Floating keyboard on iPad

    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

    opened by EddyVerbruggen 2
  • Add the possibility to customize the decimal separator character

    Add the possibility to customize the decimal separator character

    Hi, I have added the possibility to customize the decimal separator character. For example in France, the default separator is "," but I want to use this keyboard for phonenumber so I need it to be ".".

    Example of usage : keyboard.decimalCharacter = @"🐼";

    And for resetting the character : keyboard.decimalCharacter = nil;

    Thanks !

    opened by AurelTyson 2
  • Delete button can not response actoin

    Delete button can not response actoin

    Hello,sometimes the button can not response action,thank you very much

    https://user-images.githubusercontent.com/19481570/204432211-0f373b47-d12f-44ce-90f3-a0e1a314882c.mov

    opened by wzw110110 0
  • First responder <UIView> does not conform to the UIKeyInput protocol.

    First responder 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.
    
    opened by Dmurph24 0
  • Auto-Enabling return key doesn't work with external keyboard

    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.

    opened by ZevEisenberg 0
Owner
Matías Martínez
Matías Martínez
Showing / dismissing keyboard animation in simple UIViewController category.

RSKKeyboardAnimationObserver Easy way to handle iOS keyboard showing/dismissing. Introduction Working with iOS keyboard demands a lot of duplicated co

Ruslan Skorb 45 Jun 9, 2022
Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more.

IQKeyboardManager While developing iOS apps, we often run into issues where the iPhone keyboard slides up and covers the UITextField/UITextView. IQKey

Mohd Iftekhar Qurashi 15.9k Jan 8, 2023
KeyboardKit is a Swift library that helps you create custom keyboard extensions for iOS and ipadOS.

KeyboardKit is a Swift library that helps you create custom keyboard extensions for iOS and ipadOS.

KeyboardKit 900 Jan 9, 2023
⌨️A Combine-based way to observe and adjust for Keyboard notifications in SwiftUI

⌨️ Keyboard Observing A Combine-based solution for observing and avoiding the keyboard in SwiftUI. Table of Contents About Requirements Installation C

Nick Fox 440 Jan 5, 2023
Prevent keyboard from covering UITextField/UITextView, includes Swift and Objective-C APIs

Prevent keyboard from covering UITextField/UITextView with only one line of code, includes Swift and Objective-C APIs.

LiuChang 8 Oct 24, 2022
IHKeyboardAvoiding is an elegant solution for keeping any UIView visible when the keyboard is being shown - no UIScrollView required!

IHKeyboardAvoiding An elegant solution for keeping any UIView visible when the keyboard is being shown Requirements IHKeyboardAvoiding Version Objecti

Idle Hands Apps 1.4k Dec 14, 2022
Codeless manager to hide keyboard by tapping on views for iOS written in Swift

KeyboardHideManager KeyboardHideManager - codeless manager to hide keyboard by tapping on views for iOS written in Swift. Structure Features Requireme

Bondar Yaroslav 55 Oct 19, 2022
⌨️ Add user-customizable global keyboard shortcuts to your macOS app in minutes

This package lets you add support for user-customizable global keyboard shortcuts to your macOS app in minutes. It's fully sandbox and Mac App Store c

Sindre Sorhus 1.1k Dec 29, 2022
Swift UIKit keyboard manager for iOS apps.

Typist Typist is a small, drop-in Swift UIKit keyboard manager for iOS apps. It helps you manage keyboard's screen presence and behavior without notif

Toto Tvalavadze 1.1k Dec 10, 2022
Suppress mouse & keyboard events on MacOSX. Baby-proof my Mac!

Suppress mouse & keyboard events on MacOSX Catches all events (mouse, keyboard, everything), and either consumes them (locked state) or passes them th

Albert Zeyer 6 Oct 21, 2022
QMK Agent is a macOS menubar application which sends commands to a QMK enabled keyboard

QMKagent QMK Agent is a macOS menubar application which sends commands to a QMK enabled keyboard Features System volume indicator using top row (Esc t

Mike Killewald 4 Apr 24, 2022
Best way to dismiss Keyboard in a View Controller iOS (Swift)

Best way to dismiss Keyboard in a View Controller iOS (Swift) First way: Implement UITextFieldDelegate’s textFieldShouldReturn method and dismiss curr

null 0 Dec 18, 2021
Objective-C library for tracking keyboard in iOS apps.

NgKeyboardTracker Objective-c library for tracking keyboard in iOS apps. Adding to your project If you are using CocoaPods, add to your Podfile: pod '

Meiwin Fu 808 Nov 17, 2022
For less complicated keyboard event handling.

KeyboardObserver For less complicated keyboard event handling. Features Less complicated keyboard event handling. Do not use Notification , but event

Morita Naoki 163 May 24, 2022
A drop-in universal solution for moving text fields out of the way of the keyboard in iOS

TPKeyboardAvoiding A drop-in universal solution for moving text fields out of the way of the keyboard in iOS. Introduction There are a hundred and one

Michael Tyson 5.8k Dec 26, 2022
KeyboardMan helps you to make keyboard animation.

KeyboardMan We may need keyboard infomation from keyboard notifications to do animation. However, the approach is complicated and easy to make mistake

null 353 Apr 19, 2022
Emoji Keyboard SDK (iOS)

Makemoji SDK Makemoji is a free emoji keyboard for mobile apps. By installing our keyboard SDK every user of your app will instantly have access to ne

Makemoji 100 Nov 3, 2022
A Chinese keyboard for iOS that helps Chinese language learners remember tones.

ToneBoard ToneBoard is a Chinese keyboard for iOS that requires you to enter the correct tones while typing simplified Chinese with Pinyin. It is avai

Kevin Bell 7 Sep 27, 2022
SwiftyKeyboard: a full customized numeric keyboard for iOS

SwiftyKeyboard Overview SwiftyKeyboard is an iOS customized enhanced keyboard. T

SwiftyKit 2 Jun 30, 2022