Here's the basic code (based on Xcode's Tabbed Applicaion Template)
ViewController.h
@interface ViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
@property (nonatomic,retain) NSMutableArray *movies;
@property (nonatomic,retain) IBOutlet UITableView *tableView;
ViewController.m
@implementation ViewController
@synthesize movies,tableView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = NSLocalizedString(@"Watchlist", @"Watchlist");
self.tabBarItem.image = [UIImage imageNamed:@"watchlist"];
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"tableView = %@", tableView);
}
Output
tableView = (null)
The TableView is connected to File's owner in IB with class is set to ViewController
I really don't get why the tableView is null. I'm not a complete newbie to Cocoa (but to the iPhone SDK), I created a Single View based Application with a TableView dataSource to see if I was missing something. I got it working in under a minute.
Anybody can help out?