So I have created a subclass of UITableViewController and set the delegate and datasource to itself. But still the methods like cellForRowAtIndexPath
If you are extending the UITableViewController it already creates UITableView instance at viewDidLoad. Try to set a breakpoint there and check it in debugger console:
po [self view]
Therefore you should not create the UITableView instance by yourself at this point. If you need a custom init of the table view you should do it earlier
EDIT
From the documentation:
About Table Views in iOS-Based Applications
The easiest and recommended way to create a table view is to create a custom UITableViewController object. UITableViewController creates the table view and assigns itself as delegate and data source.
Creating a Table View Programmatically
If you choose not to use UITableViewController for table-view management, you must replicate what this class gives you “for free.”
- (void)loadView // <-- NOT VIEW DID LOAD!
{
UITableView *tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]
style:UITableViewStylePlain];
tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
tableView.delegate = self;
tableView.dataSource = self;
[tableView reloadData];
self.view = tableView;
[tableView release];
}
In .h file, add UITableViewDelegate and UITableViewDataSource
Something like this:
@interface Yourclass : rootClass <UITableViewDelegate, UITableViewDataSource>
try this one in .h file
@interface KLActionsViewController:UIView <UITableViewDelegate,UItableViewDataSource>
Try adding [self.tableView reloadData] at the end of the viewDidLoad