简体   繁体   English

使用performSegueWithIdentifier从TableViewCell导航到另一个视图

[英]Navigating from TableViewCell to another View with performSegueWithIdentifier

I want to navigate from a tableviewcell to another view by the cell's path. 我想通过单元格的路径从tableviewcell导航到另一个视图。 I am using the following code: 我正在使用以下代码:

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

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

As you might understand, this did not work. 如您可能理解的那样,这是行不通的。 Keep in mind that i am fairly new to xcode and objective-c. 请记住,我对xcode和Objective-c还是比较陌生。

In my head what this does is performing a segue to another view if the top cell in my tableview is pressed/released. 在我的脑海中,如果按下/释放表格视图中的顶部单元格,则会对另一视图执行搜索。 And this is also what i want to do. 这也是我想要做的。

An NSIndexPath consists of a row and a section . NSIndexPathrowsection So you probably want to use 所以你可能想使用

if (indexPath.section == 0 && indexPath.row == 0)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SWIFT-如何使用tableviewcell中的tableview中的performeguewithidentifier - SWIFT - How to use performseguewithidentifier from a tableview in tableviewcell 执行函数以从另一个类调用performSegueWithIdentifier - Execute function to call performSegueWithIdentifier from another class 如何从另一个视图中的TableViewCell图像制作Segue? - How to make Segue from TableViewCell image in another View? 滑动单元格时,有没有一种方法可以从tableViewCell导航到另一个视图控制器? - Is there a way to navigate from a tableViewCell to another view controller when a cell is swiped? 是否可以从另一个类调用performSegueWithIdentifier? - Is it possible to call a performSegueWithIdentifier from another class? TableviewCell选择并移至另一个视图 - TableviewCell select and Move to another view Ionic Framework从一个选项卡上的视图导航到另一选项卡上的视图 - Ionic Framework navigating from a view on one tab to a view on another tab 从ScrollViewController内容视图导航到堆栈上的另一个视图 - Navigating from ScrollViewController Content view to another view on stack 在 SwiftUI 中的 List Row(TableviewCell) 中单击按钮导航到详细视图 - Navigating to detail view on button click in List Row(TableviewCell) in SwiftUI 从子级调用父级视图上的performSegueWithIdentifier不会更改视图 - Calling performSegueWithIdentifier on parent view from child doesn't change view
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM