这是我的代码:
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:@"editInfo" sender:nil];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"editInfo"]) {
EditInfoViewController *vc = [segue destinationViewController];
NSInteger selectedIndex = [[self.tableView indexPathForSelectedRow] row];
NSLog(@"%d",selectedIndex);
[vc setSelectedIndex:selectedIndex];
}
else if ([[segue identifier] isEqualToString:@"sendMessage"]) {
...
}
}
selectedIndex 变量始终 NSLogged 为 0...有什么建议吗?谢谢。