我有一个 HomeViewController.m ,我在其中推送 SpecificViewController self.navigationController
,
SpecificViewController *specificViewController= [[SpecificViewController alloc] initWithNibName:@"SpecificViewController" bundle:nil];
[self.navigationController pushViewController:specificViewController animated:YES];
在SpecificViewController.m 我插入一个子视图
FirstViewController *firstViewController = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
[self.view insertSubview:firstViewController.view atIndex:0];
在FirstViewController.m 中,有一个tableview。问题是如何通过 navigationController 推送新的 ViewController,我在下面尝试过,但它不起作用。
-(void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
DetailTableViewController *detail =
[[DetailTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
[self.navigationController pushViewController:detail animated:YES];
[detail release];
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}
我还是尝试了一个新的 UINavigationController,
UINavigationController *NEWnavigationController;
NEWnavigationController=[[UINavigationController alloc] init];
[NEWnavigationController pushViewController:detail animated:YES];
但它仍然没有工作。你能给我什么建议吗?