self.tabBarController为NULL [英] self.tabBarController is NULL

查看:67
本文介绍了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];

推荐答案

In the documentation for tabBarController I see the following

如果没有标签栏,则或 接收者是模式视图, 属性为零.

If no tab bar is present or the receiver is a modal view, this property is nil.

在注释中说您正在从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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆