gpt4 book ai didi

iphone - iPad:标签栏项目标题不显示

转载 作者:行者123 更新时间:2023-12-01 19:15:38 31 4
gpt4 key购买 nike

嗨,我刚刚添加的 friend TabbarControllerUISplitViewController和相关的DetailsViewController使用波纹管代码: -

-(IBAction)loginclick:(id)sender
{

tabBarController =[[UITabBarController alloc]init];
NSMutableArray *array = [NSMutableArray array];

NSMutableArray *tabArray = [NSMutableArray array];

UISplitViewController *HomeSpilitView = [[[UISplitViewController alloc] init]autorelease];

HomeSpilitViewController *HomeMster = [[HomeSpilitViewController alloc] initWithNibName:@"HomeSpilitViewController" bundle:nil];
UINavigationController *masterNavigationController = [[[UINavigationController alloc] initWithRootViewController:HomeMster] autorelease];

[array addObject:masterNavigationController];


HomeDetailsViewController *HomeDetailsViewControllers = [[HomeDetailsViewController alloc] initWithNibName:@"HomeDetailsViewController" bundle:nil];

UINavigationController *detailNavigationController = [[[UINavigationController alloc] initWithRootViewController:HomeDetailsViewControllers] autorelease];



[array addObject:detailNavigationController];




[HomeSpilitView setViewControllers:array];

[tabArray addObject:HomeSpilitView];

HomeMster.objHomeDetailsViewcontroller = HomeDetailsViewControllers;
HomeSpilitView.delegate = HomeDetailsViewControllers;

array = [NSMutableArray array];




UISplitViewController *splitViewConntroller2 = [[[UISplitViewController alloc] init]autorelease];

REMMasterViewController *viewCont3 = [[REMMasterViewController alloc] initWithNibName:@"REMMasterViewController" bundle:nil];

UINavigationController *masterNavigationController3 = [[[UINavigationController alloc] initWithRootViewController:viewCont3] autorelease];

[array addObject:masterNavigationController3];


REMDetailViewController *viewCont4 = [[REMDetailViewController alloc] initWithNibName:@"REMDetailViewController" bundle:nil];

UINavigationController *detailNavigationController2 = [[[UINavigationController alloc] initWithRootViewController:viewCont4] autorelease];


[array addObject:detailNavigationController2];

viewCont3.detailViewController = viewCont4;

splitViewConntroller2.delegate = viewCont4;
[splitViewConntroller2 setViewControllers:array];

[tabArray addObject:splitViewConntroller2];



// Add the tab bar controller's current view as a subview of the window
[tabBarController setViewControllers:tabArray];

objAppdelegate.window.rootViewController=tabBarController;


}

我在每个 ViewController 中设置导航标题在 - (id)initWithNibName像:-
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = NSLocalizedString(@"Detail", @"Detail");

// self.navigationItem.title=@"details"; I am trying with this line code also
// self.tabBarItem.title=@"details";

}
return self;
}

在上面我也用 self.navigationItem.title=@"details 设置标题, self.tabBarItem.title=@"details但我仍然有同样的问题,我不知道错误在哪里,请指导我并提供帮助。

谢谢

最佳答案

当您在初始化方法中为 View Controller 设置标题时, View Controller 不在导航 Controller 堆栈中。仅当 View Controller 位于导航 Controller 中时,标题才可见。在导航 Controller 堆栈中添加这些 Controller 后,设置标题以查看 Controller 。在您的情况下,在使用 View Controller 作为 Root View vontrollers 创建导航 Controller 之后。

关于iphone - iPad:标签栏项目标题不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13578472/

31 4 0