Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何将tableView中的行链接到序列_Ios_Objective C_Segue_Uistoryboardsegue_Unwind Segue - Fatal编程技术网

Ios 如何将tableView中的行链接到序列

Ios 如何将tableView中的行链接到序列,ios,objective-c,segue,uistoryboardsegue,unwind-segue,Ios,Objective C,Segue,Uistoryboardsegue,Unwind Segue,我有两个ViewController,ViewController和TableViewController。ViewController有一个按钮,按下时TableViewController将启动。TableViewController包含5行 我想做的是,当我只按偶数行时,我应该返回ViewController。为了解决这个问题,我们可以使用unwindSegue,但我不知道如何让segue响应表中的偶数行 请让我知道如何在表中创建一行链接到segue 下面是TableViewControl

我有两个ViewController,ViewController和TableViewController。ViewController有一个按钮,按下时TableViewController将启动。TableViewController包含5行

我想做的是,当我只按偶数行时,我应该返回ViewController。为了解决这个问题,我们可以使用unwindSegue,但我不知道如何让segue响应表中的偶数行

请让我知道如何在表中创建一行链接到segue

下面是TableViewController的代码

代码

#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

您可以在中调用PerformsgueWithIdentifierdidSelectRowAtIndexPath@ReinierMelian但是我无法将tableview链接到exit图标来创建一个Unwindsegue在ViewController和destinationViewController之间创建一个segue并放置一个标识您甚至不需要unwind segue,只需弹出或关闭当前控制器即可@TejaNandamuri你能提供代码吗
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath: 
(NSIndexPath *)indexPath {
    if(indexPath.row % 2 == 0) {
         // Even row...
    }

}