Let tableview's last cell scroll to half way up the screen
I have a tableview with custom cells. Each cell has a UITextfield. When the last cell's textfield is clicked, the keyboard pops up and covers it and the table view won't scroll up any further. Is there a property of UITableview that can be set so that the last cell can scroll to half way up the screen?
开发者_StackOverflowThanks in advance
There are a two ways to approach this (that I can think about off the top of my head):
- You can use the
tableFooterView
property ofUITableView
to set an arbitrary, empty view to be about half the size of your table. - You can add empty cells to the bottom of your table
Both of these approaches will accomplish roughly the same thing, but using the tableFooterView
property is probably your best bet.
see Making a UITableView scroll when text field is selected for a list of solution..
Also basing your view controller from UITableViewController (since you say its a table) will provide all this functionality automatically!
精彩评论