[英]UINavigationController inside a UITabBarController with several views in the navigation controller
I've got a UINavigationController
that has a UITableViewController
as it's root view. 我有一个UINavigationController
,其中有一个UITableViewController
作为其根视图。 The UINavigationController
is inside a UITabBarController
. UINavigationController
在UITabBarController
内部。
In the UITableViewController (*viewOne), if I click a cell a the following code runs 在UITableViewController(* viewOne)中,如果我单击一个单元格,则会运行以下代码
UIViewController *newView = [[UIViewController alloc] initWithNibName:@"newView" bundle:nil];
[self.navigationController pushViewController:newView animated:YES];
[newView release];
Then, inside of newView is: 然后,在newView内部是:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
NSLog(@"%@", self.navigationController);
}
return self;
}
The logs have: 日志有:
[8947:207] (null)
And if I try to push a new view controller to the navigationController, nothing happens. 而且,如果我尝试将新的视图控制器推送到navigationController,则什么也不会发生。 Any clues? 有什么线索吗?
I've figured it out. 我知道了。
In my application delegate, I've added a new property: 在我的应用程序委托中,我添加了一个新属性:
UINavigationController *profileNavigationController;
@property (nonatomic, retain) IBOutlet UINavigationController *profileNavigationController;
And in IB, I've connected the profileNavigationController from the app delegate to Navigation Controller. 在IB中,我已将profileNavigationController从应用程序委托连接到Navigation Controller。
And now, when pushing new views, I call: 现在,当推动新观点时,我称:
StartDateSelectorViewController *startDateSelectorViewController = [[StartDateSelectorViewController alloc] initWithNibName:@"StartDateSelectorView" bundle:nil];
Strength_EngineAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.profileNavigationController pushViewController:startDateSelectorViewController animated:YES ];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.