Ios 从编辑附件中分离出来

Ios 从编辑附件中分离出来,ios,uitableview,segue,Ios,Uitableview,Segue,在Xcode中,当我尝试将视图控制器与segue连接时,我可以选择在选择表格单元格时启动segue,或者从单元格的附件启动segue。如何创建要从故事板上看不到的单元格编辑附件中触发的序列号?添加accessoryButtonTappedForRowWithIndexPath委托方法,然后在该委托方法中添加序列号 // Tap on row accessory - (void) tableView: (UITableView *) tableView accessoryButtonTap

在Xcode中,当我尝试将视图控制器与segue连接时,我可以选择在选择表格单元格时启动segue,或者从单元格的附件启动segue。如何创建要从故事板上看不到的单元格编辑附件中触发的序列号?

添加accessoryButtonTappedForRowWithIndexPath委托方法,然后在该委托方法中添加序列号

// Tap on row accessory
    - (void) tableView: (UITableView *) tableView accessoryButtonTappedForRowWithIndexPath: (NSIndexPath *) indexPath{
           [self performSegueWithIdentifier:"MyVC" sender:self];
    }
如果您使用的是navigationcontroller

// Tap on row accessory
    - (void) tableView: (UITableView *) tableView accessoryButtonTappedForRowWithIndexPath: (NSIndexPath *) indexPath{
           ViewController * vc = [self.storyboard instantiateViewControllerWithIdentifier:@"MyVC"];
           [[self navigationController] pushViewController:vc animated:YES];
    }

当您点击附件按钮时,会调用此方法,但如果您想在行中点击此方法,请使用didSelectRowAtIndexPath方法

将序列从视图控制器挂接到目标控制器。并在需要时手动调用performsguewithidentifier:sender:。