Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to pass data between two ViewControllers where first VC having two tableViews, second tableView selected data should pass to second VC?
    primarykey
    data
    text
    <p>I have two tableViews in a <strong>ViewController</strong>. I want to pass the second tableView data to second ViewController.</p> <p>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 <strong>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</strong>. I am getting problem at "<strong>DidSelectRowAtIndexPath</strong>" method. Please help me on this problem and send me the code.</p> <p>Its my code</p> <pre><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]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload