PDA

View Full Version : Change return to done on keyboard




seVor
Aug 20, 2008, 12:33 PM
I know its a dumb question but how can I change the return button on the keyboard to done?



sgauravv
Aug 20, 2008, 12:39 PM
it is just simple
I u r using..........NIb file then u can simply change using properties
or if u r doing programtically
then simply use this
UITextView *textField = [[UITextView alloc] initWithFrame:frame];
textField.returnKeyType = UIReturnKeyDone;

i think now u can do.

seVor
Aug 20, 2008, 12:58 PM
Cool Thanks..... Oh How do you handle the done key? I have a button on my screen and I want the done key to do the same functionality.

TeeJayEm
Aug 20, 2008, 06:32 PM
Cool Thanks..... Oh How do you handle the done key? I have a button on my screen and I want the done key to do the same functionality.

you need to implement the following.
-(BOOL) textFieldShouldReturn:(UITextField *)textField

Ex:
-(BOOL) textFieldShouldReturn:(UITextField *)textField
{
if (textField == txtUserName) [txtPassword becomeFirstResponder]; //Set focus to password field
else if (textField == txtPassword) [self OnLogin: textField]; //Call OnLogin

return YES;
}