views:

366

answers:

1

Hi,

I want that my 4 cells will be in the center of my UITableView. Can't scroll the UITableView. That there will be the same height above the first cell and below the last cell.

thanks

+6  A: 

Create an empty UIView, set its height to the height you require, and then set that view as the tableHeaderView.

You can do it all from Interface Builder, even.

If you want to calculate what height is required:

CGFloat headerHeight = (tableView.size.height - tableView.rowHeight * [tableView numberOfRowsInSection:0])  / 2; 
// assuming one section, otherwise add all sections
Aviad Ben Dov
Thanks man.Sounds good.
donodare
If it answered your question, mark it as an answer, too! :)
Aviad Ben Dov