gpt4 book ai didi

iphone - self.tabBarController 为 NULL

转载 作者:搜寻专家 更新时间:2023-10-30 20:01:15 24 4
gpt4 key购买 nike

我创建了一个如下所示的 UITabBarController 并推送了一个 navigationController,但我现在无法设置选项卡栏项目的标题等...因为 tabbarcontroller 为 NULL。

请你告诉我哪里错了。

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];

最佳答案

documentation对于 tabBarController,我看到以下内容

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

在评论中它说您正在从 LoggedInFeedNavigationController 中调用 self.tabBarController,我认为它应该可以正常工作。但是您正在以模态方式显示选项卡栏,如果文档意味着即使它作为模态视图位于 UITabBarController 内部,那么这就是您的问题。

关于iphone - self.tabBarController 为 NULL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6444666/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com