I have two tableViews in a ViewController. I want to pass the second tableView data to second ViewController.
Now whenever clicking on Category, that related data will display in SubCategory table. Now if i click on SubCategory data like "Identity planar and solid figures", that cell label text should be pass to next viewController. i can pass data but whenever clicking on Second table cell, that is not going to next ViewController. The problem is i am not able to go to next View with passing data. I am getting problem at "DidSelectRowAtIndexPath" method. Please help me on this problem and send me the code.
Its my code
-(void)viewDidLoad
{
NSMutableArray *Mute_Category=[[NSMutableArray alloc]initWithObjects:@"Geometry", @"Mixed operations", nil];
NSMutableArray *Mute_Sub_Category=[[NSMutableArray alloc]initWithObjects:@"Identify planar and solid figures", @"Open and closed shapes and qualities of polygons", @"Nets of 3-dimensional figures", @"Types of angles", nil];
tag=1;
[table_category reloadData];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;
{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
{
if (tag==1)
{
return [Mute_category count];
}
else
{
return [Mute_Sub_Category count];
}
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
cell=[[UITableViewCell alloc]init];
if (tag==1)
{
cell.textLabel.text=[Mute_category objectAtIndex:indexPath.row];
}
else
{
cell.textLabel.text=[Mute_Sub_Category objectAtIndex:indexPath.row];
}
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
{
NSString *localStr=[Mute_category objectAtIndex:indexPath.row];
tag=2;
[table_sub_category reloadData];
}