If you are doing things programatically and are using a UITableViewController
without a UINavigationController
your best bet is to do the following in viewDidLoad
:
Swift 3
self.tableView.contentInset = UIEdgeInsets(top: 20, left: 0, bottom: 0, right: 0)
Earlier Swift
self.tableView.contentInset = UIEdgeInsetsMake(20.0f, 0.0f, 0.0f, 0.0f);
The UITableViewController
will still scroll behind the status bar but won't be under it when scrolled to the top.