views:

50

answers:

1

I have a UITableView that holds just two cells with a textfield in each. As my tableview is just for editing the text in these textfields I always want the keyboard to be shown static in the bottom of the screen. So in viewDidLoad I set the first textfield to become first responder.

Something I have noticed though is that when I push the UITableViewController into the UINavigationController the keyboard show up a little bit slower so you can see it animate into the screen. It would be much better if it was there already there when the uitableview shows up.

I also tried making the textfield first responder before pushing it as recommended but that didn't made the keyboard show at all:

MyTableViewController *myTableViewController = [[MyTableViewController alloc] initWithNibName:@"MyTableViewController" bundle:nil];
[myTableViewController.textField becomeFirstResponder];
[self.navigationController pushViewController:myTableViewController animated:YES];
[myTableViewController release];

How can I accomplish this?

Thanks!

A: 

take the textfield as public(set its property and synthesis) and from the place you are pushing it before that push set the first textfields to become first responder... and then push to the controller...

There can be much more options but this is the one i can suggest... may be it help...

Happy Coding....

Suriya
This doesn't show the keyboard at all. You can see my code in my question above. Am I doing something wrong?
Martin
ohh.. Please check whether your textfield is allocated or not.. Put the debug point over here.I am sure your textbox must not have been allocated.. allocate your textField by setting proper frame before [.. becomefirstresponder]; and dont forget to remove the reallocation in the mytableviewcontroller for textfield
Suriya
Aha yes you are right it is not allocated, but the textField is an IBOutlet: @property (nonatomic, retain) IBOutlet UITextField *textField; So shouldn't it get allocated in initWithNibName?
Martin
if you have taken it in the xib file and have binded it with the textfield taken in the code then it would get allocated. But i suppose you have taken it in the Code and not in the uiinterface. So we have to do it manually
Suriya