IPDecimalNumberPad 0.2.0

IPDecimalNumberPad 0.2.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Nov 2015

Maintained by Nick Servidio.



  • By
  • Nick Servidio

Usage

Demo Gif

Many apps require a user to enter in a decimal value with a number pad. Oftentimes this is accomplished with a keyboard. However, displaying a number pad within your UI can also provide an enjoyable user experience (see Square Cash and Venmo). One particularly common use case is the need for users to enter an amount of currency into an app.

The classes in this library provide a quick way to introduce a number pad into your app. For those who want to get started immediately, use the IPDecimalNumberPadController. This class includes a number pad and an accompanying label that displays the value entered as US dollars.

You can change the display of this class by hiding the amountLabel property and overriding the method:

- (void)handleCurrentAmountUpdate:(NSString *)currentAmount

You can then update a different UILabel or another element that displays text. You can adjust the insets surrounding the number pad to reposition it within the IPDecimalNumberPadController.

You can also customize the IPDecimalNumberPad itself. You can assign a value to the number pad’s buttonClass property. The number pad will then use this class to instantiate the buttons included in its UI. You can also provide a rowDividerImage, columnDividerImage, and deleteButtonImage. The IPDecimalNumberPad automatically creates resizable images from the row and column divider images that you supply.

For those looking for complete customization, you can use the IPDecimalNumberPad in your own UIViewController subclass. You can use the included IPStringBackedDecimalValue to hold the current value entered into the number pad, or create your own model.

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

IPDecimalNumberPad is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "IPDecimalNumberPad"

Author

Nick Servidio, [email protected]

License

IPDecimalNumberPad is available under the MIT license. See the LICENSE file for more info.