简体   繁体   English

UITabBarController内部的UINavigationController,在导航控制器中具有多个视图

[英]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 . UINavigationControllerUITabBarController内部。

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.

相关问题 UITabBarController中的UINavigationController,设置导航控制器标题 - UINavigationController within a UITabBarController, setting the navigation controller title UINavigationController里面的UITavBartController里面的UINavigationController - UINavigationController inside a UITabBarController inside a UINavigationController 在UINavigationController内的UITabBarcontroller中添加UINavigationController? - Adding a UINavigationController in a UITabBarcontroller inside of a UINavigationController? UITabBarController和UINavigationController内部的自动旋转视图 - Autorotate view inside UITabBarController and UINavigationController UINavigationController中的UITabBarController可在iOS 8上运行,但不能在7上运行 - UITabBarController inside UINavigationController works on iOS 8 but not 7 UINavigationController中的UITabBarController中的popView - popView from UITabBarController inside UINavigationController UITabBarController 内部的 UINavigationController 问题,viewWillAppear 未调用 - Problems with UINavigationController inside of UITabBarController, viewWillAppear not called 你可以在 UINavigationController 中推送一个 UITabBarController - Can you push a UITabBarController inside an UINavigationController 如何在UINavigationController和UITabBarController内部翻转视图(使用UIModalTransitionStyleFlipHorizo​​ntal) - How to Flip a view (with UIModalTransitionStyleFlipHorizontal) inside UINavigationController and UITabBarController 在UITabBarController中设置UINavigationController的UITabBarItem - Set UINavigationController's UITabBarItem inside a UITabBarController
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM