Reputation:
I have created a UITableView
that is of type UITableViewStyleGrouped
. I have then created several different sections with a few rows in each. Within each of these rows I have created a custom UITableViewCell
that contains a UITextField
. I also have one UITableViewCell
that contains a UITextView
.
I have also implemented a UIToolbar
that appears on top of the UIKeyboard
that allows the user to move through the UITextField
's by pressing previous or next.
The issue I'm having is two-fold:
UITextField
(or UITextView
) becomes the first responder it is visible (even with the keyboard being displayed).UITextField
(or UITextView
) is selected (without using the previous and next buttons) is should adjust so that the field is visible above the keyboard.I have looked around at lots of different tutorials however none of them have resolved my issue. Any help you could offer would be hugely appreciated.
ADDITIONAL INFO:
I'm 100% certain that my app used to do all of the above automatically, however I seems to have stopped doing it now and I don't understand why. Is there a reason why this may of happened? Is there some function or something that I may have changed that would destroy this behaviour?
Upvotes: 4
Views: 5112
Reputation: 5393
Probably no use to original poster now, but those having an issue like this where it once did work and then stopped...
check you don't have a:
- (void)viewWillAppear:(BOOL)animated
in your UITableViewController subclass!!!
using viewWillAppear in a UITableViewController breaks the "automagic tableView scrolling up when keyboard appears" behaviour.
I only found this by comparing laboriously an old version of a project where it did work with my latest source where it had stopped working.
Upvotes: 14
Reputation: 3312
Check out TaggedLocations sample code from apple. It does the same thing without any extra manipulation.
The key is that your viewcontrollers are following the standard. i.e you are NOT having container viewcontrollers such as UINavigationController within UIViewController.
Upvotes: 4
Reputation: 21805
You have to update tableview Frame yourself programatically... and i am 100% sure that if you are 100% certain that your app used to do all of the above automatically ...than it is not your app.
Check the docs..here is the link
You will have to register for keyboard notifications..and then update your tableview frame. And for next and previous.. you have to programmatically check which textfield became active..and then set the frame accordingly.
Upvotes: -5