Darren Findlay
Darren Findlay

Reputation: 2563

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?

Thanks in advance

Upvotes: 0

Views: 1112

Answers (2)

Tony Million
Tony Million

Reputation: 4296

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!

Upvotes: 0

Hyperbole
Hyperbole

Reputation: 3947

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.

Upvotes: 2

Related Questions