HI,如何在tableview中插入一個新的viewController,這是一個導航控制器的插入視圖?
我在我通過self.navigationController推SpecificViewController一個HomeViewController.m,
SpecificViewController *specificViewController=
[[SpecificViewController的alloc] initWithNibName:@ 「SpecificViewController」 束:無];
[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,有實現代碼如下。問題是我如何通過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];
,但它仍然沒有奏效。你能給我任何建議嗎?