I am creating a view at runtime and adding a UITableView as its subview. I have also defined the delegate of the tableview to self .
But still the UITableView Delegates are not getting called
@interface cViewController : UIViewController
RouteShowView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
[RouteShowView setBackgroundColor:[UIColor blueColor]];
table = [[UITableView alloc] initWithFrame:CGRectMake(0, 50, 320, 410) style:UITableViewStylePlain];
table.delegate = self;
UIButton * Go = [UIButton buttonWithType:UIButtonTypeRoundedRect];
Go.frame = CGRectMake(0, 4, 70, 42);
[Go setTitle:@"<< BACK" forState:UIControlStateNormal];
[Go addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
[Go setBackgroundColor:[UIColor blackColor]];
[RouteShowView addSubview:table];
[RouteShowView addSubview:Go];
[self.view addSubview:RouteShowView];
UITableView'sdatasourceis more important and it is required. Try withtable.datasource=self.and don't forget to add methodscellForRowAtIndexPathandnumberOfRowsInSection- iNoobself.view addSubView:tableinstead of yourRouteShowView. - iNoob