I've stepped into a similar problem a few minutes ago and was able to solve it after being pointed to the right direction in a different (and IMHO more elegant) way:
Add the following line at the beginning of your UITableViewController
subclass implementation:
@synthesize tableView;
Add the following code to the beginning of your init
method of your UITableViewController
subclass, like initWithNibName:bundle:
(the beginning of viewDidLoad
might work as well, although I recommend an init
method):
if (!tableView &&
[self.view isKindOfClass:[UITableView class]]) {
tableView = (UITableView *)self.view;
}
self.view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
self.tableView.frame = self.view.bounds;
self.tableView.contentInset = UIEdgeInsetsMake(0.0, 0.0, 0.0, 0.0);
[self.view addSubview:self.tableView];
Then you don't need to change your code you posted in your question any more. What the above code does is basically seperating the self.tableView
from self.view
(which was a reference to the same object as self.tableView
before, but now is a UIView
containing the table view as one might expect).