本文介绍了self.tabBarController为NULL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了如下所示的UITabBarController并推送了NavigationController,但是由于tabbarcontroller为NULL,所以现在我无法设置标签栏项的标题等.

I created a UITabBarController like the following and pushed a navigationController, but I now cannot set the title of tab bar items etc... as the tabbarcontroller is NULL.

请你告诉我我要去哪里错了.

Please can you tell me where I am going wrong.

UITabBarController *tabBarController = [[UITabBarController alloc] init];
        LoggedInFeedNavigationController *lvc = [[LoggedInFeedNavigationController alloc] initWithAccount:account];
        [tabBarController setViewControllers:[NSArray arrayWithObject:lvc]];
        [tabBarController setSelectedIndex:0];
        [self presentModalViewController:tabBarController animated:YES];
        [tabBarController release];
        [lvc release];

推荐答案

文档 for tabBarController我看到以下

In the documentation for tabBarController I see the following

在注释中说您正在从LoggedInFeedNavigationController内部调用self.tabBarController,我认为它应该可以正常工作.但是,您正在以模式方式显示选项卡栏,并且如果文档的意思是即使它在UITabBarController内作为模式视图也存在,那么这就是您的问题.

In the comments it says that you are calling self.tabBarController from within the LoggedInFeedNavigationController and I would think it should work properly. But you are displaying the tab bar modally and if the documentation means even if it is inside of UITabBarController as a modal view then that is your problem.

这篇关于self.tabBarController为NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 07:14