Я создаю UITableView программно без файлов NIB здесь. Однако я делаю что-то глупое, так как моя навигационная панель нормально отображается, как и мой UITableView. Однако UITableView неправильно помещается на экране. Вы увидите примерно 20 пикселей, разделяющих UINavigationBar и UITableView. Я установил backgroundColor моего окна на черный, как вы можете видеть на снимке экрана:
Вот код для воспроизведения проблемы:
- (void)loadView
{
[super loadView];
// TableViews that wish to utilize tableView footers/headers should override this method.
UITableView *aTableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain];
aTableView.autoresizingMask = (UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight);
aTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
aTableView.delegate = self;
aTableView.dataSource = dataSource;
self.tableView = aTableView;
[self.view addSubview:self.tableView];
[aTableView release];
// style navigation bar.
//self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
}