J'ai deux viewControllers, ViewController et TableViewController. le ViewController a un bouton, une fois pressé le TableViewController commencera. le TableViewContoller contient 5 lignes. Ce que j'essaye de faire est, quand j'appuie seulement les lignes paires je devrais retourner à ViewController. Pour résoudre ce problème, nous pouvons utiliser unwindSegue, mais je ne sais pas comment le segue répond aux lignes paires de la table.comment ligne de lien dans tableView à une section
s'il vous plaît laissez-moi savoir comment faire une ligne dans la table liée à la Segue
ci-dessous est le code pour TableViewController
Code:
#import "TableViewController.h"
@interface TableViewController()
@property NSArray *tableData;
@end
@implementation TableViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.tableData = [NSArray arrayWithObjects:@"Android",
@"iOS",
@"swift",
@"objective-c",
@"openCV",nil];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:
(NSInteger)section {
return [self.tableData count];
}
-(UITableViewCell *) tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *simpleTableIdentifier = @"SimpleTableItem";
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:simpleTableIdentifier];
}
cell.textLabel.text = [self.tableData objectAtIndex:indexPath.row];
cell.imageView.image = [UIImage imageNamed:@"images.jpg"];
return cell;
}
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:
(NSIndexPath *)indexPath {
NSLog(@"%li", indexPath.row);
NSLog(@"%@", [self.tableData objectAtIndex:indexPath.row]);
}
@end
vous pouvez appeler performSegueWithIdentifier dans didSelectRowAtIndexPath –
@ReinierMelian mais je ne peux pas lier la vue de table à l'icône de sortie pour créer un windsegue – user2121
faites la segue entre votre ViewController et votre destinationViewController et mettre un identifiant –