I have created an view based app and added two table view controller in that.Here is my flow of events Viewcontroller button is pressed–>Tableview controller loads and if a cell is selected –>second table controller is shown.
here is my code.In Viewcontroller.m
-(IBAction)product:(id)sender
{
Products *sec=[[Products alloc]init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:sec];
[self presentModalViewController:nav animated:YES];
}
In my 1st Tableview controller named as products.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.
Description *detailViewController = [[Description alloc] initWithNibName:@"Description" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
My second TableView controller named as description.Now the issue is my second tableview controller not getting displayed and i’m getting issue as
*** Assertion failure in -[UITableView _createPreparedCellForGlobalRow:withIndexPath:], /SourceCache/UIKit_Sim/UIKit-1914.84/UITableView.m:6061
2012-08-03 15:10:51.016 jothi R&D[1112:f803] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
*** First throw call stack:
(0x13d3022 0x1564cd6 0x137ba48 0x9b42cb 0xb7d28 0xb83ce 0xa3cbd 0xb26f1 0x5bd21 0x13d4e42 0x1d8b679 0x1d95579 0x1d1a4f7 0x1d1c3f6 0x1d1bad0 0x13a799e 0x133e640 0x130a4c6 0x1309d84 0x1309c9b 0x12bc7d8 0x12bc88a 0x1d626 0x22a2 0x2215 0x1)
terminate called throwing an exception
But if i tried to display Viewcontroller by replacing the description in products.m it works..
Kindly guide me…
Here the solution is In Second Tableview controller add the condition if cell is nil it have to display the table view style.Add the following code in