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

标签 ios objective-c uitableview

我想通过单元格的路径从 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/

相关文章:

ios - 在 xcode 中运行单独的 View / Controller

ios - 动态调整UITableView高度

加载相机应用程序后,iOS 8 网络应用程序屏幕缩小

ios - 将导航标题设置为 2 个字符串

iphone - UITabBarController 选中的项目

ios - 如何循环遍历 UITableView 中尚未可见的单元格?

ios - 在调用 reloadData 之前,Autolayout 会错误地调整 UITableViewCells 的大小

ios - 如何快速将 NSArray 合并到 NSMutableArray?

objective-c - 如何控制嵌套的 ScrollView

ios - 在 iOS 9 中通过 WhatsApp 共享字符串 + 图像