开发者社区> 问答> 正文

uitabbar controller中标题显示的问题

ios

iphone

使用以下代码创建了uitabbarview controller
在uitabbarview controller中我想为每一个视图显示标题
怎么样为每个视图添加标题呢(标题栏项目)?

myTabBarController = [[UITabBarController alloc] init];

    MyDialerViewController *aDialerViewController = [[MyDialerViewController alloc]init];
    MyCallLogViewController *aCallLogViewController = [[MyCallLogViewController alloc] init];
    TemplateViewController *aTemplateViewController = [[TemplateViewController alloc] init];    


    NSArray* controllers = [NSArray arrayWithObjects:aDialerViewController, aCallLogViewController, aTemplateViewController, nil];
    myTabBarController.viewControllers = controllers;
    myTabBarController.delegate = self;
    myTabBarController.selectedIndex = 0;

    [controllers release];
    [aDialerViewController release];
    [aCallLogViewController release];
    [aTemplateViewController release];

    [self.window addSubview:myTabBarController.view];

    [self.window makeKeyAndVisible];

展开
收起
爵霸 2016-05-27 11:25:57 1911 0
1 条回答
写回答
取消 提交回答
  • 在appDelegate里面直接设置navcontroller的标题。同时也在viewcontroller里面的viewDidLoad 中设置。

    aDialerViewController.title = NSLocalizedString(@"Dialer Title", @"Dialer Title");
    aCallLogViewController.title = @"Title";
    aTemplateViewController.title = @"Title";
    2019-07-17 19:17:30
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载