我有一张桌子:
- (void)viewWillAppear:(BOOL)animated
{
self.searchBar.delegate=self;
self.searchResultTable.delegate=self;
self.searchResultTable.dataSource=self;
[self.searchResultTable setHidden:YES];
}
在我的单元格中,我插入文本,当我点击单元格时,我需要转到另一个表格,但这不起作用:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
TableViewController *tvc=[[TableViewController alloc]initWithStyle:UITableViewStyleGrouped];
[self.navigationController pushViewController:tvc animated:YES];
}
答案 0 :(得分:1)
假设你正在做这样的事情来呈现这个控制器:
SearchViewController *searchViewController = [SearchViewController alloc] init];
[self presentModalViewController:searchViewController animated:YES];
然后您的视图控制器没有导航控制器
您需要将其更改为
SearchViewController *searchViewController = [SearchViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:searchViewController];
[self presentModalViewController:navController animated:YES];
然后[self.navigationController pushViewController:tvc animated:YES];
将起作用