我正在尝试构建一个带有 tableView 的应用程序,到目前为止我已经达到了填充 tableView 的程度,但是当我按下行时我无法发生任何事情。任何帮助,将不胜感激。如果您缺少一些可以帮助我的代码,请询问,我会发布它。
使用 NSLog,我确定当我按下一行时会调用该操作,但不会推送下一个 viewController。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"DidSelectRow");
// UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
galleriaDetailViewController *galleriaDetail = [[galleriaDetailViewController alloc] initWithNibName:@"galleriaDetail" bundle:nil];
[self.navigationController pushViewController:galleriaDetail animated:YES];
}
谢谢!
最佳答案
从你的评论中我发现你正在使用 Storyboard。如果你使用 Storyboard意味着,那么你为什么要尝试访问 Nib 。
试试这个代码
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"DidSelectRow");
// UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
galleriaDetailViewController *galleriaDetail = [self.storyboard instantiateViewControllerWithIdentifier:@"galleriaView"]; // galleriaView is a identifier for that view.you have to set in your storyboard
[self.navigationController pushViewController:galleriaDetail animated:YES];
}
关于ios - DidSelectRowAt ..什么也没发生,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10366620/