我有一个 UIViewController,里面有两个 UITableView。当我在第一个 UITableView 中选择一行时,它必须推送不会发生的相同 UIViewController。
在 UIViewController.hi 中有,
FirstTableViewController *firstController;
SecondTableViewController *secondController;
在 UIViewController.mi 中有,
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
if (firstController == nil) {
firstController = [[FirstTableViewController alloc] init];
}
if (secondController == nil) {
secondController = [[SecondTableViewController alloc] init];
}
UINavigationController *firstNavigationController = [[UINavigationController alloc] initWithRootViewController:firstController];
firstController.product = self.product;
[firstTable setDataSource:firstController];
[firstTable setDelegate:firstController];
firstNavigationController.view = firstController.tableView;
}
在 FirstTableViewController.m 中,我有 didSelectRowAtIndexPath,
[self.searchDisplayController setActive:YES animated:YES];
UIViewController *controller = [[UIViewController alloc]initWithNibName:@"UIViewController" bundle:nil];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller];
navController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
controller.product = prod;
NSLog(@"Navigation controller is %@",self.navigationController); //not null
[[self navigationController]pushViewController:controller animated:YES];
请帮忙。
编辑#1:从 UtilityApp 的 FlipsideViewController 调用 UIViewController。