views:

231

answers:

3

How I can disappear numeric keyboard in iPhone because there is no return key in it, which implies it is not going to respond to

- (BOOL)textFieldShouldReturn:(UITextField *)textField
+1  A: 

Try this:

[theTextField resignFirstResponder];
ennuikiller
Well you do this within the function which i have wrote above, like this. Anyhow where i should put this code to work?
itsaboutcode
+1  A: 

Duplicate of:

And that was just on the first page of search results...

Dave DeLong
I am afraid you are wrong because they all are talking about when Keyboard is not of Numeric Type, I know how to disable the keyboard when its not numeric, its different case, when you have to disappear "NUMERIC Keyboard". And i search before putting that question.
itsaboutcode
You can easily put a button on your screen to dismiss the keyboard once the user has entered the number. Isn't that how the phone app works? Or you could put a toolbar above the keyboard with a "don" button on it, or any number of things (automatically dismiss the keyboard after x seconds of inactivity, once the text in the field validates, etc etc)
Dave DeLong
[theTextField resignFirstResponder]; works no matter what keyboard you have.
Jordan
A: 

Add this to your textfield owner:

-(BOOL) textFieldShouldReturn:(UITextField*) textField {
    [textField resignFirstResponder]; 
    return YES;
}

-and setup the owner as the textfield's delegate in Interfacebuilder.(must people who experience this problem, forgot this step).

Cipramill
As OP says, there is no return button in the numeric keypad which means the `textFieldShouldReturn` method can't be called. So this is the wrong place to resign the first responder.
BoltClock