开发者

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?

开发者_StackOverflow

Thanks 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 of UITableView 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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜