if([segue.identifier isEqualToString:@"Edit"]){
AddCoffeeViewController *avc = [segue destinationViewController];
Coffee *coffeeObj = [appDelegate.coffeeArray objectAtIndex:arow];
NSLog(@"ViewController.m prepareForSegue: arow: %d coffeeName:%@ price:%@ coffeeID:%d",arow,coffeeObj.coffeeName,coffeeObj.price,coffeeObj.coffeeID);
[coffeeObj setIsInEditMode:YES];
avc.EditCoffeeObj = coffeeObj;
}
当我按下附件按钮时,我没有得到正确的行。
虽然在下面的方法中我得到了正确的行。
如果我不想使用任何 ivar,有什么方法可以让我为 segue 准备正确的行。
-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{
arow = indexPath.row;
}
tableViewCell 附件按钮:执行模式转场(编辑)
+ Button (Navigation bar button Item): 执行模态转场(Add)
最佳答案
如果您在 Storyboard中连接了辅助操作,则 prepareForSegue:sender:
中的 sender
将是被点击的单元格。这意味着你可以做类似的事情
NSIndexPath *indexPath = [self.tableView indexPathForCell:sender];
关于ios - indexpath 行未准备好 segue 以进行详细信息披露,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14813786/