views:

28

answers:

2

I've added a UITableView component to a ViewController in Interface Builder to make it easier to customise as the UITableViewController won't let me set a background image.

I've then implemented some basic functions just to test if it works, but cannot get it to display any cells - does anyone have any suggestions on how to get it working?

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 3;
}


// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section     {
    if (section == 1) {
        return 2;
    }
    else {
        return 1;
    }
}

I've created a UITableView IBOutlet called tripSettings and have wired it up as a referencing outlet

A: 

Make sure that the tableView as your view controller as dataSource and delegate.

gcamp
A: 

you have to make your class inherit from UIViewController , and then set the delegate and datasource to the file's owner using the interface builder

sfa