我想通过单元格的路径从 tableviewcell 导航到另一个 View 。 我正在使用以下代码:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath == 0) {
[self performSegueWithIdentifier:@"segueToKnutene" sender:self];
}
如您所知,这没有用。 请记住,我对 Xcode 和 Objective-C 还很陌生。
在我看来,如果我的表格 View 中的顶部单元格被按下/释放,则执行到另一个 View 的segue。而这也是我想做的。
最佳答案
NSIndexPath
由行
和部分
组成。
所以你可能想使用
if (indexPath.section == 0 && indexPath.row == 0)
关于ios - 使用performSegueWithIdentifier从TableViewCell导航到另一个 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22491517/