-3

私はテーブルを持っています:

- (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];
}
4

1 に答える 1

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];動作します

于 2013-03-16T20:49:19.097 に答える