【发布时间】:2012-08-27 10:59:12
【问题描述】:
我有一个 UIViewController,里面有两个 UITableView。当我在第一个 UITableView 中选择一行时,它必须推送相同的 UIViewController,这不会发生。
在 UIViewController.h 我有,
FirstTableViewController *firstController;
SecondTableViewController *secondController;
在 UIViewController.m 我有,
- (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。
【问题讨论】:
-
[self navigationController]是否返回nil? -
没有。它返回
标签: iphone objective-c ios xcode cocoa