Reputation: 14864
According to the answer at UITableView, make footer stay at bottom of screen?, which I verify:
In order to have a footer that stays put at the bottom of the screen, and doesn't scroll with the table, then you can't use a table view footer. You can't even use a UITableViewController, you'll need to implement your view controller as a UIViewController. Then you add your own table view as a subview. You'll also need to add your footer as a subview of the view controller's view, not the table view. Make sure you size the table view so its bottom is at the top of the footer view.
but the problem is that my UITextField, inside my footer, is being hidden by the keyboard when user tries to type. So how do I keep the keyboard from hiding the UITextField? Throughout the app, I have been using TPKeyboardAvoiding. But in this case, where a UIScrollView/TPKeyboardAvoidingScrollView contains a UITableView and a UIView in vertical order, it does not work. I generally like TPKeyboardAvoiding because it’s so quick and easy. Any ideas how I might fix this issue?
Upvotes: 1
Views: 1346
Reputation: 11607
The instruction that you quote is telling you to use a UIViewController, add a UITableView as a subview, then add a UITextField as a subview of the UIViewController NOT as a subview of the UITableView.
Let me draw it out for you:
Add a UITableView to your view controller
Add your UITextField subview (you can embed the UITextField in a UIView container if you like) as a subview of your UIViewController's view NOT your UITableView footer.
If depending on if your using frames or autolayout, you adjust the frame or autolayout constraint constant values for your UITextField subview when user tap on the text field.
Finally, the keyboard appears and the UITextField doesn't get obscured by the keyboard.
Upvotes: 1
Reputation: 515
Just make sure your UITableView doesn't initialize it's own automatic scrolling for keyboard appearing. If you use UITableViewController then just subclass it and make sure you don't call it's viewWillAppear:. I didn't investigate which exactly method you should block without using UITableViewController, so, you should find out this yourself or somebody else would help.
I did similar in my own project where I wanted to have own scrolling of table view for keyboard appearing.
Upvotes: 0