There is one other possible way. For those who are looking for something perfect then vodkhang's answer is very good. But if you are looking for some work-around then textField.inputAccessoryView
can be useful. The idea is to show done button in inputAccessoryView
. Following is sample code
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 60, 25)];
view.backgroundColor = [UIColor grayColor];
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:@"Done" forState:UIControlStateNormal];
button.frame = CGRectMake(320-60, 0, 60, 25);
[view addSubview:button];
textField.inputAccessoryView = view;
There are few things to be noted.
- Width of
accessoryView
is equal to screen width. So you need to write some code for managing look and feel according to your application.
- You can give any kind of look to you dome button. And here you don't have to worry about Apple's design changes in keyboard.