1

嗨朋友我刚刚添加TabbarController并使用波纹管代码UISplitViewController相关:-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=@"detailsself.tabBarItem.title=@"details但我仍然有同样的问题我不知道错误在哪里,请指导我并帮助。

谢谢

4

2 回答 2

2

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

于 2012-11-27T06:35:22.403 回答
1

解决

在添加tabbarController窗口之前使用波纹管解决

[[self.tabBarController.tabBar.items objectAtIndex:1] setTitle:NSLocalizedString(@"BotonMapas", @"comment")];

于 2012-12-03T05:09:24.423 回答