English 中文(简体)
UIViewController.navigation Controller成为无
原标题:UIViewController.navigationController becomes nil

I bumped into a problem where UIViewController.navigationController into nil and I m Weily seeking an response to this one.

The UINavigationController have set up in the application delegation:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    self.rootViewController = [[RootViewController alloc] initWithNibName:@"RootView" bundle:nil];

    UINavigationController* navigationController = [[UINavigationController alloc] initWithRootViewController:self.rootViewController];
    [self.window addSubview:navigationController.view];

    [self.window makeKeyAndVisible];

    return YES;
}

当登上时,即为成员,我可以使用该成员隐藏导航条,如:

- (void)viewWillAppear:(BOOL)animated {
    NSLog( @"self = %@, self.navigationController = %@", self, self.navigationController );
    [self.navigationController setNavigationBarHidden:YES animated:NO];
}

缩略产出显示<代码>本身和本身.navigationController的数值。

当该控制器点击ton子时,自行 www.un.org/Depts/DGACM/index_french.htm

- (IBAction)buttonClicked:(id)sender {
        NSLog( @"self = %@, self.navigationController = %@", self, self.navigationController );
        // here, self.navigationController is nil, so
        // [self.navigationController pushViewController:...] doesn t work :-(
}

我看到了数十个有关这个问题的问题,答案始终是<代码>。 UIViewController不是< IDNavigationController>的一部分。 由于进入<代码>navigationController>,viewWillAppear,我认为有必要做其他事情。 你们是否有任何点? 我很乐意在必要时提供更多细节。

最佳回答

你的法典显示,你只是利用导航。 主计长认为,只是祈祷航行 主计长的生活由一些神职人员处理,但情况并非如此。

你们需要成为航行的明确所有人 这里的主计长。

事实上,以下各行:

[self.window addSubview:navigationController.view];

seems to indicate that what you want is for the window s rootViewController to be navigationController:

self.window.rootViewController = navigationController;

但是,申请代表似乎是航行所有人。 主计长兼航 事实上,主计长应当成为你的 delegate。

简言之,确定你的标本(与你手工保存的外表同时做,并固定你的标本)

问题回答

Try this in the app delegate:

[(UINavigationController *)self.window.rootViewController pushViewController:yourViewController animated:NO];

如果主讲人赞成删除,则主讲控制器实际上是<条码>。 这为我工作。

我与一位神职控制员有问题,发现这名控制员没有在故事板上与随行代表适当联系。

As always, it helps to formulate the question just to find the solution some minutes later.

我对保护儿童权利行动感到 pre。 在申请代表中,我保留了<条码>,即:纳吉丁/条码”,然后做罚款。





相关问题
combining flipsideview and navigationview

when i am trying to combine flipsideview and navigation view i am getting following error "request for member delegate is something not in a structure or union" on the line controller.delegate = ...

Lost my nib connection: how to get it back?

I am writing my very first genuine program for the IPhone. In the course of developing it, I decided to rename a subsidiary view controller (not RootViewController), so I renamed the .h and .m and ....

Calling another view from within a view class

i may be making more out of this because of the late hour. i am confused. i have multiple views i call from a viewcontroller class. typically they are called with a uibutton object. say i have two ...

热门标签