I have a UITableViewController with 3 static cells on it in one section. I'd like to align the whole table to the bottom, not to the top. I tried to set several settings in Xcode bit could not solve it. How can I do this?
UPDATE: so, this is the alignment I want, the cells are in red:
Thanks
If you manually compute the height of your rows, you can set the table view's contentInset
(inherited from UIScrollView
) to push the rows down. You'll have to manually update the inset if you change the table rows. For example, if all of your rows are the same height:
CGFloat totalRowHeight = [self.tableView numberOfRowsInSection:0] * self.tableView.rowHeight;
CGFloat topInset = MAX(0, self.tableView.bounds.size.height - totalRowHeight);
self.tableView.contentInset = UIEdgeInsetsMake(topInset, 0, 0, 0);
Use a large positive value for the table view's top content inset. This will push the cells down as far as you specify.
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