[英]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
. NSIndexPath
由row
和section
。 So you probably want to use 所以你可能想使用
if (indexPath.section == 0 && indexPath.row == 0)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.