Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Top margin on UITableViewController

I have a TabBarController, one of the tabs of which contains a sub view which is a navigationController. I am then loading into the navigation controller a view which inherits form UITableViewController.

My problem is thta for some reason the table view starts behing the navigation controller, not the top of the screen but about half way down the navigation bar, hence the top of the first cell in the table view is cut off.

Can anyone suggest how to move the UITableViewController down?

like image 653
agough Avatar asked Oct 09 '09 13:10

agough


People also ask

Why is there extra padding at the top of my UITableView?

Starting in iOS7, there is additional space at the top of my UITableView 's which have a style UITableViewStyleGrouped . The tableview starts at the first arrow, there are 35 pixels of unexplained padding, then the green header is a UIView returned by viewForHeaderInSection (where the section is 0).

What is UITableView in Swift?

A view that presents data using rows in a single column. iOS 2.0+ iPadOS 2.0+ Mac Catalyst 13.1+ tvOS 9.0+


1 Answers

Fix it programmatically:

   - (void)viewDidLoad {        UIEdgeInsets inset = UIEdgeInsetsMake(20, 0, 0, 0);        self.tableView.contentInset = inset;    } 
like image 63
sunkencity Avatar answered Sep 28 '22 18:09

sunkencity