Tag Archives: UIKeyboardTypeNumberPad

iPhone – Add the Return Key for UIKeyboardTypeNumberPad in iPhone SDK 4

A few months ago, i have a post talking about adding a return button for UIKeyboardTypeNumberPad.
iPhone – Add the Return Key for UIKeyboardTypeNumberPad

But that only works in iOS SDK <= 3.2M. After i upgrade it to 4.0, that feature was broken.

It is found that the we have add the observer to the UIKeyboardDidShowNotification instead of UIKeyboardWillShowNotification. Moreover, the view prefix is changed from <UIKeyboard to <UIPeripheralHostView. Here comes the code. Continue reading iPhone – Add the Return Key for UIKeyboardTypeNumberPad in iPhone SDK 4

Advertisements

iPhone – Add the Return Key for UIKeyboardTypeNumberPad

Update @ 2012-11-10: This solution in this post is outdated. please refer to the comment made by Jonny for the solution in iOS 6.

When you try to use the UIKeyboardTypeNumberPad for a UITextField, you will release that there is no return key and so the UIKeyboardTypeNumberPad cannot be dismissed.

Luckily, i find out a very good article which talk about the solution of the missing return key. It makes use of the NSNotification and NSNotificationCenter such that a DONE button image will pasted on the bottom left of the UIKeyboardTypeNumberPad. Here is the code for returning from the number pad after editing a UITextField.

*Update on 2010-09-11: The approach does not work in iOS SDK >= 4.0. if your are using 4.0, you can take a look at iPhone – Add the Return Key for UIKeyboardTypeNumberPad in iPhone SDK 4.

Continue reading iPhone – Add the Return Key for UIKeyboardTypeNumberPad