使用performSegueWithIdentifier从TableViewCell导航到另一个View

时间:2014-03-18 21:33:02

标签: ios objective-c uitableview

我想通过单元格的路径从tableviewcell导航到另一个视图。 我使用以下代码:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

if (indexPath == 0) {
    [self performSegueWithIdentifier:@"segueToKnutene" sender:self];
}

正如您可能理解的那样,这不起作用。 请记住,我对xcode和objective-c相当新。

在我的脑海中,如果我的tableview中的顶部单元格被按下/释放,它的作用是对另一个视图执行segue。这也是我想要做的。

1 个答案:

答案 0 :(得分:1)

NSIndexPathrowsection组成。 所以你可能想用

if (indexPath.section == 0 && indexPath.row == 0)
相关问题