iOS TabbarController 设置底部Toolbar图片和文字颜色选中样式
2016-09-01 17:31
645 查看
提取公共方法:
使用方法:
-(void)createChildVcWithVc:(UIViewController *)vc Title:(NSString *)title image:(NSString *)image selectedImage:(NSString *)selectedImage { //图片渲染 vc.tabBarItem.title=title; vc.navigationItem.title=title; vc.tabBarItem.image=[UIImage imageNamed:image]; vc.tabBarItem.selectedImage=[[UIImage imageNamed:selectedImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; //文字渲染 NSMutableDictionary *dict=[NSMutableDictionary dictionary]; dict[NSForegroundColorAttributeName]=[UIColor blackColor]; [vc.tabBarItem setTitleTextAttributes:dict forState:UIControlStateNormal]; //选中的文字渲染 dict[NSForegroundColorAttributeName]=[UIColor orangeColor]; [vc.tabBarItem setTitleTextAttributes:dict forState:UIControlStateSelected]; YJNavigationController *nav=[[YJNavigationController alloc] initWithRootViewController:vc]; [self addChildViewController:nav]; }
使用方法:
YJMeViewController *me=[[YJMeViewController alloc] init]; [self createChildVcWithVc:me Title:@"我" image:@"tabbar_profile" selectedImage:@"tabbar_profile_selected"];
相关文章推荐
- 设置 TabBarItem 选中时的图片及文字颜色
- iOS开发 在storyboard中拖的UITabBarController,设置选中时的图片和字体颜色
- UITabBarController设置选中时图片和文字的颜色
- 【iOS开发】设置TabBarItem上文字跟图片一样的颜色
- IOS UITabBar+UINavigation(改变背景/标题文字颜色、状态图片、tabbar选中方形背景、item间距)
- iOS 设置UITabBar,背景颜色,默认图片,文字颜色,和选中颜色.
- swift-UITabBarController 设置选中和未选中状态文字图片颜色或使用原图
- TabBar 的selecedImage无法显示设置图片问题 和item文字颜色选中设置
- 设置tabBar的背景图片,选中文字颜色
- tabbar 设置选中文字的颜色
- iOS tabBar颜色渲染和改变选中时图片
- JTextPane例子,演示为文字设置字体、字号、样式、颜色、背景色和插入图片功能
- JTextPane的例子,模拟聊天客户端,演示了为每段文字设置字体、字号、样式、颜色、背景色和插入图片功能
- ios中对于tabBar选中图片设置的问题
- ios 设置tabbar选中颜色
- JTextPane例子,演示为文字设置字体、字号、样式、颜色、背景色和插入图片功能
- ios更改UITabBarController背景以及选中背景图片的方法 以及隐藏tabbar
- iOS UITabBarController底部tabbar的item间距设置
- iOS开发UITabBarController设置选中图片
- IOS设置导航栏全局的背景图片、导航栏title文字颜色大小、导航栏左右按钮的颜色。