PDA

View Full Version : About done button in keypad




iphonejudy
Dec 3, 2008, 01:41 AM
Hi,

When i edited the text,the keypad is open.But it has no done button to close the keypad.

So,i create a button and write the below code.
//When done buton click
- (IBAction)doneButtonOnKeyboardPressed: (id)sender
{
[textField resignFirstResponder];

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

So i want to display this button when keypad open(When the page load it should be hidden)

I tried this in,

- (void)viewDidLoad {
button.hidden=true;
}

But its not working.
Can anybody please tell me the code?

1)To hide the button when view load.
2)To display button when keypad opens.

Thanks
judy



dejo
Dec 3, 2008, 10:21 AM
Why not just put the Done button on the keyboard, like so:
textfield.returnKeyType = UIReturnKeyDone;

iphonejudy
Dec 3, 2008, 11:36 PM
Why not just put the Done button on the keyboard, like so:
textfield.returnKeyType = UIReturnKeyDone;



In which event i need to write the code ?

iphonejudy
Dec 4, 2008, 12:17 AM
In which event i need to write the code ?



Thanks.i finished the task.