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
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
you need to use tableView.bounds.size.height instead of tableView.size.height and subtract the sectionHeaderHeight as well
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With