I have following code in a subclass of UITableViewController. Under iOS 5.1 it works fine, but under iOS 6, self.tableView is nil (both in simulator and on real device). Am I doing it wrong? Why isn't the view set straight away after the init?
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self)
{
UIView * bck = [[UIView alloc] init];
[bck setBackgroundColor:[UIColor whiteColor]];
self.tableView.backgroundView = bck;
[bck release];
}
return self;
}
EDIT:
I've nailed down the problem:
I've got class
AccountsListViewController_iPad
which is subclass of
AccountsListViewController : UITableViewController
AccountsListViewController has it's tableView & view loaded after init (as I would expect). AccountsListViewController_iPad on the other hand has it's view and tableView equal to nil. I've removed everything from AccountsListViewController_iPad so now it looks as follows:
.h
#import <UIKit/UIKit.h>
#import "AccountsListViewController.h"
@interface AccountsListViewController_iPad : AccountsListViewController
@end
.m
#import "AccountsListViewController_iPad.h"
@implementation AccountsListViewController_iPad
@end
And still it's view is nil. In my opinion, it should behave exactly the same as its superclass, but it doesn't.