//
// 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. PHP网站简单架构 – 单独跑php-fpm

    这个架构比较简单,不做过多的说明 前端1台Nginx:负载均衡+nfs 中间2台php:php-fpm 后端1台数据库:MySQL 安装略,参考<lnmp最新源码一键安装包> 192.16 ...

  2. SSH与SSL

    1. SSL SSH 即Secure Shell,它主要由三部分组成: 第一部分:连接协议 [SSH-CONNECT] 将多个加密隧道分成逻辑通道.它运行在用户认证协议上.它提供了交互式登录话路.远程 ...

  3. HDU 4793 Collision (2013长沙现场赛,简单计算几何)

    Collision Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

  4. LCA + 二分(倍增)

    两个最近的点u和v的最近的公共的祖先称为最近公共祖先(LCA).普通的LCA算法,每算一次LCA的时间复杂度为线性o(n); 这里讲LCA + 二分的方法.首先对于任意的节点v,利用其父节点的信息,可 ...

  5. UOJ Test Round #2

    昨天晚上打的这个比赛,简直一颗赛艇啊-- 感觉发挥的并不好.比赛的时候比较紧张,最后一题还脑残写了个离散化结果爆零了,哎我怎么这么逗逼-- 讲讲比赛经过吧. 比赛之前逗逼地以为是8:00开始,然后淡定 ...

  6. c# 如何使用DLL的config文件中的信息

    我知道用c#编写的exe程序可以读取config文件中的配置信息,比如Test.exe,可以在与Test.exe相同目录下放置一个config文件:Test.exe.config,用System.Co ...

  7. 对PostgreSQL中tablespace 与 database, table的理解

    开始: 当前的tablesapce信息 pgsql=# select * from pg_tablespace; spcname | spcowner | spclocation | spcacl | ...

  8. Weka – 分类

    1.      weka简单介绍 1)  weka是新西兰怀卡托大学WEKA小组用JAVA开发的机器学习/数据挖掘开源软件. 2)  相关资源链接 http://sourceforge.net/pro ...

  9. android SoundPool播放音效

    MediaPlayer的缺点: 资源占用量高,延时时间较长 不支持多个音效同一时候播放 SoundPool主要用于播放一些较短的声音片段,CPU资源占用率低和反应延时小,还支持自行色设置声音的品质,音 ...

  10. mvc4 web-api 与unity搭建接口

    对于接口重要的应该是 功能实现,合法性验证,性能监控,日志等模块 通过unity aop功能可以实现统一的日志模块和性能监控. 1.新建mvc4 webapi项目 nuget添加 unity 3.0+ ...