//
// TabBarViewController.h
// LittleLoveLive
//
// Created by YJ
//
// TabBarViewController.m
// LittleLoveLive
//
// Created by YJ on 16/7/16.
// Copyright © 2016年 YJ. All rights reserved.
// #import "TabBarViewController.h"
#import "RootNavigationController.h"
#import "HomeViewController.h"
#import "LiveViewController.h"
#import "MeViewController.h"
@interface TabBarViewController () @end @implementation TabBarViewController - (void)viewDidLoad {
[super viewDidLoad]; [self setupTheLine];
[self initialControllers]; } //初始化子控制器
-(void)initialControllers { [self setupController:[[HomeViewController alloc]init] image:@"icon_home_normal.png" selectedImage:@"icon_home_pressed.png" title:nil];
[self setupController:[[LiveViewController alloc]init] image:@"icon_live_normal.png" selectedImage:@"icon_live_pressed.png" title:nil];
[self setupController:[[MeViewController alloc] init] image:@"icon_me_normal.png" selectedImage:@"icon_me_pressed.png" title:nil]; } //设置控制器
-(void)setupController:(UIViewController *)childVc image:(NSString *)image selectedImage:(NSString *)selectedImage title:(NSString *)title { //标题
childVc.title = title;
//childVc.view.backgroundColor = RGBACOLOR(239.0f, 239.0f, 244.0f, 1.0f); //tabBarItem图片
childVc.tabBarItem.image = [[UIImage imageNamed:image] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
childVc.tabBarItem.selectedImage = [[UIImage imageNamed:selectedImage]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; //tabBarItem字体的设置
//正常状态
NSMutableDictionary *normalText = [NSMutableDictionary dictionary];
normalText[NSForegroundColorAttributeName] = [UIColor colorWithRed:/255.0 green:/255.0 blue:/255.0 alpha:1.0];
[childVc.tabBarItem setTitleTextAttributes:normalText forState:UIControlStateNormal]; //选中状态
NSMutableDictionary *selectedText = [NSMutableDictionary dictionary];
selectedText[NSForegroundColorAttributeName] = [UIColor blackColor];
[childVc.tabBarItem setTitleTextAttributes:selectedText forState:UIControlStateSelected]; RootNavigationController *nav = [[RootNavigationController alloc]initWithRootViewController:childVc];
[self addChildViewController:nav]; } //设置分割线
-(void)setupTheLine { UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(, -, self.tabBar.frame.size.width, self.tabBar.frame.size.height)];
[imageView setImage:[UIImage imageNamed:@"bg_tabbar"]];
[imageView setContentMode:UIViewContentModeCenter];
[self.tabBar insertSubview:imageView atIndex:];
//覆盖原生Tabbar的上横线
[[UITabBar appearance] setShadowImage:[self createImageWithColor:[UIColor clearColor]]];
[[UITabBar appearance] setBackgroundImage:[self createImageWithColor:[UIColor clearColor]]];
//设置TintColor
// UITabBar.appearance.tintColor = [UIColor orangeColor]; } -(UIImage*) createImageWithColor:(UIColor*) color
{
CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return theImage;
} //设置中间按钮不受TintColor影响
- (void)awakeFromNib {
[super awakeFromNib];
NSArray *items = self.tabBar.items;
//设置第几个 tabBar不受影响
UITabBarItem *btnAdd = items[];
btnAdd.image = [btnAdd.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
btnAdd.selectedImage = [btnAdd.selectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
} - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end

 on 16/7/16.
// Copyright © 2016年 YJ. All rights reserved.
// #import <UIKit/UIKit.h> @interface TabBarViewController : UITabBarController @end

自定义弧形的 tabBar的更多相关文章

  1. 自定义react-navigation的TabBar

    在某些情况下,默认的react-navigation的tab bar无法满足开发者的要求.这个时候就需要自定义一个tab bar了.本文就基于react-navigtion v2来演示如何实现一个自定 ...

  2. iOS 自定义UITabBarController的tabBar

               #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDeleg ...

  3. iOS 自定义滑动切换TabBar

    貌似经常会用到,自己整理收藏起来,方便日后查找备用. 效果如图: 由于制作gif,调整了属性,所以看起来的效果不好.如果用默认配置,生成的gif会很大. 制作gif: 1.使用QuickTimePla ...

  4. Nuxt/Vue自定义导航栏Topbar+标签栏Tabbar组件

    基于Vue.js实现自定义Topbar+Tabbar组件|仿咸鱼底部凸起导航 最近一直在倒腾Nuxt项目,由于Nuxt.js是基于Vue.js的服务端渲染框架,只要是会vue,基本能很快上手了. 一般 ...

  5. 自定义UITabBar的两种方式

    开发中,经常会遇到各种各样的奇葩设计要求,因为apple提供的UITabBar样式单一,只是简单的"图片+文字"样式,高度49又不可以改变.自定义UITabBar成为了唯一的出路. ...

  6. swift-UINavigationController纯代码自定义导航控制器及底部工具栏的使用

    step1:自定义一个类  NTViewController,该类继承UITabBarController: // // NTViewController.swift // Housekeeper / ...

  7. svelte组件:Svelte3自定义Navbar+Tabbr组件|svelte自定义插件

    基于Svelte3自定义组件Navbar+Tabbar沉浸式导航条|底部凸起菜单栏 Svelte 一种全新的构建用户界面的框架.当下热门的 Vue 和 React 在浏览器中需要做大量的工作,而 Sv ...

  8. github代码集合(转载)

    菜鸟新闻项目课程源码  https://github.com/yxs666/cniao5-news SwipeRefreshLayout + RecyclerView 下拉刷新和上拉加载更多 http ...

  9. iOS各种开源类库

    KissXml——xml解析库 相关教程:http://www.iteye.com/topic/625849 http://sencho.blog.163.com/blog/static/830562 ...

随机推荐

  1. Spark Streaming 原理剖析

    通过源码呈现 Spark Streaming 的底层机制. 1. 初始化与接收数据 Spark Streaming 通过分布在各个节点上的接收器,缓存接收到的流数据,并将流数 据 包 装 成 Spar ...

  2. HiveContext VS SQLContext

    There are two ways to create context in Spark SQL: SqlContext:scala> import org.apache.spark.sql. ...

  3. CKEditor与CKFinder整合并实现文件上传功能

    事先说明:此整合的是java版本的, 用到的有:jsp + ckeditor + ckfinder (没有servlet 及其它框架技术) 一.需要的资源: 用到的网站,文件自己下载: a) cked ...

  4. 更新插件时提示“正在更新缓存”“正在等待jockey-backend退出”

    Ubuntu 11 更新语言插件, 更新时 提示正在更新缓存”“正在等待jockey-backend退出”,然后就不动了. 解决方案: 在终端中键入ps -e | grep jockey 系统会显示一 ...

  5. CDOJ 483 Data Structure Problem DFS

    Data Structure Problem Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/proble ...

  6. 【Lucene4.8教程之四】分析

    1.基础内容 (1)相关概念 分析(Analysis),在Lucene中指的是将域(Field)文本转换成最主要的索引表示单元--项(Term)的过程.在搜索过程中,这些项用于决定什么样的文档可以匹配 ...

  7. Anroid自定义RatingBar,显示半个(小数个)的stepSize时,变为整数个的问题

    <RatingBar android:id="@+id/rb_starbar" style="@style/joblist_item_ratingbar_style ...

  8. Apache Solr采用Java开发、基于Lucene的全文搜索服务器

    http://docs.spring.io/spring-data/solr/ 首先介绍一下solr: Apache Solr (读音: SOLer) 是一个开源.高性能.采用Java开发.基于Luc ...

  9. Oracle DB 通过 Oracle Enterprise Manager注册要使用的恢复目录

    通过 Oracle Enterprise Manager  注册要使用的恢复目录.  a)  在 EM 中,导航到“Availability > Recovery Catalog Setting ...

  10. [Angular 2] Directive intro and exportAs

    First, What is directive, what is the difference between component and directive. For my understandi ...