场景:

在xcode8.3下  今天在弄工程的时候,发现把之前工程中的tabbar控制器拿过来后,在控制器里面用 controller.tabBarItem.title = @"11111"不显示

之前用着一直没问题

代码如下

===============================================

#pragma mark -

- (void)viewDidLoad {

[super viewDidLoad];

[self addChildVc];

}

-(void)addChildVc

{

OneViewController * infoVc = [[OneViewController alloc] init];

[self addChildVc:infoVc withTitle:@"1" withImage:@"shuju_1" withSelectedImage:@"info"];

}

-(void)addChildVc:(UIViewController *)controller withTitle:(NSString *)title withImage:(NSString *)image withSelectedImage:(NSString *)selectedImage

{

// 设置子控制器的文字

//    controller.title = title; // 同时设置tabbar和navigationBar的文字

//    本工程不需要设置导航的标题,所以不用上一句

controller.tabBarItem.title = title; // 设置tabbar的文字

//    controller.navigationItem.title = title; // 设置navigationBar的文字

#pragma mark 设置子控制器的 tabBarItem.image

controller.tabBarItem.image = [UIImage imageNamed:image];

controller.tabBarItem.selectedImage = [[UIImage imageNamed:selectedImage]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

#pragma mark 先给外面传进来的小控制器 包装 一个导航控制器

ZNavigationController *nav = [[ZNavigationController alloc] initWithRootViewController:controller];

#pragma mark 添加为子控制器

[self addChildViewController:nav];

}

===============================================

尝试了

controller.title = title;  和

controller.navigationItem.title = title;

都可以在tab或者navi上显示相应的标题,唯独用    controller.tabBarItem.title = title; 显示不出来

挺奇怪

后来把

[self addChildVc:infoVc withTitle:@"1" withImage:@"shuju_1" withSelectedImage:@"info"];

里面的图片shuju_1和info真正加到工程里才可以了

xcode 等有的时候也有bug,比较怪。具体原因归结为xcode的。  有具体知道原因的欢迎评论

controller.tabBarItem.title = @"11111"不显示的更多相关文章

  1. iOS 11 导航栏 item 偏移问题 和 Swift 下 UIButton 设置 title、image 显示问题

    html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,bi ...

  2. Spring 框架下Controller 返回结果在EasyUI显示

    这几天弄了一下java下的在后台返回数据到jsp页面上的显示: 总结一下: 首先后台方面: @RequestMapping(value="/searchByUserName") @ ...

  3. Activity标题(title)的显示和隐藏

    开发Android应用程序,我们总会遇到Activity的title把显示的内容遮挡了一部分.如果能把它去掉,我们的应用界面就会变得更加简洁,那该多好.下面有两种方法可以去掉: (方法一):通过一句J ...

  4. HTML title属性换行显示的方法

    原文发布时间为:2009-04-22 -- 来源于本人的百度文章 [由搬家工具导入] 解决的方法有两种: 1.将title属性分成几行来写,例如:<a href=#" title=&q ...

  5. iOS 控制器title和tabbar的title设置问题

    iOS 设置tabbarItem的title的是通过 controller.tabBarItem.title = @"标题" iOS 设置导航栏控制器title通过 contoll ...

  6. iOS基础 - 控制器管理

    一.Container 一个iOS的app很少只由一个ViewController组成,除非这个app极其简单.当app中有多个ViewController的时候,我们就需要对这些ViewContro ...

  7. iOS:UI简单的总结

    UI简单总结: 一.常用单例: NSBundle *bundel = [NSBundle mainBundle]; //加载资源 NSFileManager *fm = [NSFileManager  ...

  8. iOS:切换视图的第三种方式:UITabBarController标签栏控制器

    UITabBarController:标签栏控制器 •通过设置viewControllers属性或者addChildViewController方法可以添加子控制器 –NSArray *viewCon ...

  9. iOS开发200个tips总结(一)

    tip 1 :  给UIImage添加毛玻璃效果 func blurImage(value:NSNumber) -> UIImage { let context = CIContext(opti ...

随机推荐

  1. js获取当月最后一天

    构造函数 new Date(); new Date(value); new Date(dateString); new Date(year, month[, day[, hour[, minutes[ ...

  2. (纪录片)光的故事 BBC Light Fantastic (2004)

    简介: 导演: Jeremy Turner主演: Simon Schaffer / Dimitri Andreas ... Al Hazen / Edmund Dehn ... Priest/Old ...

  3. 【Android界面实现】使用PagerTabStrip实现有滑动标签的Viewpager

    在ViewPager这样的能够滑动的控件上,总是有非常多的文章能够做.上次的文章,我们实现了一个自己定义的ViewPager的指示器,这篇文章,我们主要是想利用Android自带的控件,实现一个指示器 ...

  4. ionic3中创建pipe管道

    1.使用ionic cli创建pipe管道文件 ionic g pipe parse-date 该命令会在src文件夹创建pipes/parse-date/parse-date.ts文件,并且会在pi ...

  5. Unity3D for Mac 破解

    每次版本更新又忘记怎么搞了.干脆记下来! 1安装Unity 2安装成功后打开Applecation>Unity>Unity(右击显示包内容)>contents>MacOS 3用 ...

  6. PAT《数据结构学习与实验指导》实验项目集 2-05 2-06 2-07 2-08

    题目地址:here pat 2-05 求集合数据的均方差 没什么可说的,大水题 #include<cstdio> #include<cmath> int main() { in ...

  7. poj - 1191 - 棋盘切割(dp)

    题意:将一个8*8的棋盘(每一个单元正方形有个分值)沿直线(竖或横)割掉一块,留下一块,对留下的这块继续这样操作,总共进行n - 1次,得到n块(1 < n < 15)矩形,每一个矩形的分 ...

  8. SpringMVC学习笔记五:使用converter进行参数数据转换

    转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/6832898.html  一:SpringMVC数据绑定机制 1:request到达SpringMVC框架时,框 ...

  9. Android开发经典笔试面试题汇总(持续更新中)

    1.我们都知道Handler是线程与Activity通信的桥梁,假设线程处理不当.你的机器就会变得非常慢,那么线程销毁的方法是:(A) A. onDestroy() B. onClear() C. o ...

  10. 〖Linux〗转换Socks Proxy为Http Proxy

    使用工具,privoxy,官网: http://www.privoxy.org/ socks5 proxy设定方法: autossh -CgNfD  0.0.0.0:1080 vps-lxb sock ...