I am looking for a way to dismiss the number pad in xcode 4.2. I have seen a few suggestions for xcode 3 but none of them seem to work for me. It seems silly that there is no clear/non work around way to dismiss the numberpad of a uitextview. Maybe I am just missing something but I have tried about 10 diff ways with no success. If someone could point me towards a current tutorial or share some super secret tricks that would be great thanks!
Asked
Active
Viewed 678 times
0
-
3What were the ways you tried? – macbirdie Dec 10 '11 at 08:26
-
So `[myTextView resignFirstResponder];` doesn't work? If not, is your text embedded in a a view controller that is being present by `presentModelViewController:animated:`? – DarkDust Dec 10 '11 at 08:30
-
first I tried setting up this numberpad just like my default keyboards. had the return key set to done (there is no return key on numberpad). added - (IBAction) textFieldDoneEditing:(id) sender; to h file added - - (IBAction)textFieldDoneEditing:(id) sender { [sender resignFirstResponder]; } to .m file and linked this up to the textfield box i wanted to perform this action (this did not work). second creating a button to dismiss the keypad. Simply adding the [sender resignFirstResponder]; in the button ibaction. I even nslogged the button to check for clicking – TouchMint Dec 11 '11 at 21:28
1 Answers
2
Dismissing keyboard on any text input control is simply sending resignFirstResponder
message to the control. You don't control the keyboard directly.
And this is completely unrelated to XCode version.

macbirdie
- 16,086
- 6
- 47
- 54
-
There is a case where this doesn't work. It's about modal view controllers on the iPad. See [`disablesAutomaticKeyboardDismissal`](http://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/disablesAutomaticKeyboardDismissal). – DarkDust Dec 10 '11 at 09:54
-
Yeah, especially the FormSheet type modal controller. I heard that it's assumed that such controller shows up for the purpose of data entry, so the keyboard stays popped out. That is a problematic issue in some cases. Don't get me started on handling screen rotation in this situation. :) The OP has to specify what problem he has. – macbirdie Dec 10 '11 at 11:34
-
Actually I didn't know about the method you mentioned. This should help with the above issues. – macbirdie Dec 10 '11 at 16:01