NMBottomTabBarController

A customisable tab bar controller for iOS written in Objective C. It uses auto layout.

一个自定义的Tabbar控制器,使用了自动布局。

Requirements

  1. iOS 7.1 +
  2. ARC
Image Requirements for configuring the tab bar items
  1. Icon image  图标文件
  2. Selected and unselected background image  选中状态和未选中状态的背景图

Features

  1. Uses autolayout 使用了自动布局
  2. You can set custom background images, icons and text( custom font and colour) for selected, unselected states of the tabs. 你可以使用自定义的背景图,图标,文本(包括字体颜色以及颜色)的选中和未选中状态值
  3. There are two configurations for the arrangement of text and icon image (Text to the right of icon image and text to the bottom of icon image)  有两种关于文本和图片的配置(图片在左文本在右或者图片在下文本在上)
  4. You can assign controllers for each of the tabs. 你可以给每一个tab设置一个控制器
  5. NMBottomTabBarController will take care of the switching and displaying of the controller views when user switches the tabs. NMBottomTabBarController会处理好控制器的切换操作
  6. In addition the tabs can be switched programatically as required. tabs会自动切换,所以不用你担心什么

Installation

  1. Please Download the source files 先下载文件
  2. Drag and drop the NMBottomTabBarController folder into your project 将NMBottomTabBarController文件夹拖到你的项目当中
  3. Include objective-c #import "NMBottomTabBarController.h" wherever necessary 在需要的地方引入头文件NMBottomTabBarController.h

Usage

Add a controller and change its custom class to NMBottomTabBarController.

添加一个控制器,然后让他继承自NMBottomTabBarController。

From the controller where you want to display the tab bar controller you can do the initial set up.

然后在你的控制器中进行初始化。

To add a set of controllers that the tab bar controller manages
UIViewController *oneController = [UIViewController new];
oneController.view.backgroundColor = [UIColor greenColor];
UIViewController *twoController = [UIViewController new];
twoController.view.backgroundColor = [UIColor blueColor];
UIViewController *threeController = [UIViewController new];
threeController.view.backgroundColor = [UIColor purpleColor];
UIViewController *fourController = [UIViewController new];
fourController.view.backgroundColor = [UIColor orangeColor]; NMBottomTabBarController *tabBarController = (NMBottomTabBarController *)self.window.rootViewController; tabBarController.controllers = [NSArray arrayWithObjects:oneController,twoController,threeController,fourController, nil];
To set the separator image used between tabs
 tabBarController.tabBar.separatorImage = [UIImage imageNamed:@"separator.jpg"];
Title and Text Orientation

There are two title and text orientations

有两种文本显示方式:

  1. kTitleToRightOfIcon - Places title to the right of the icon image 标题在右图标在左
  2. kTItleToBottomOfIcon - Places title to the nottom of the icon image You can learn how to set these in the next step 标题在下图标在上
To set custom background images, icon, title text and title text orientation
 [tabBarController.tabBar configureTabAtIndex:0 andTitleOrientation :kTitleToRightOfIcon withUnselectedBackgroundImage:[UIImage imageNamed:@"unselected.jpeg"] selectedBackgroundImage:[UIImage imageNamed:@"selected.jpeg"] iconImage:[UIImage imageNamed:@"home"] andText:@"Home"andTextFont:[UIFont systemFontOfSize:12.0] andFontColour:[UIColor whiteColor]];
To select a particular tab programatically
 [tabBarController selectTabAtIndex:0];
Delegates

There are two delegates available for NMBottomTabBarController

NMBottomTabBarController提供两个代理方法:

-(BOOL)shouldSelectTabAtIndex : (NSInteger)index;

It can be used to determine whether to allow the selection of a particular tab

这个可以用来决定是否允许某个tab被选中:

-(void)didSelectTabAtIndex : (NSInteger)index;

It can be used to perform any action once a tab is selected

这个可以用来执行任何的操作,当某个tab被选中的时候

To Do

  1. Set selected and unselected attributed text, icon images 设置选中与未选中状态的富文本
  2. Add a more button and display the controllers on next page when the tabs exceed a certain limit. 添加一个按钮,在另外的一个控制器中显示tab。

License

The project is licensed under the MIT license. For more information please see the [LICENSE][https://github.com/priankaliz/NMBottomTabBarController/blob/master/LICENSE] file

Credits

NMBottomTabBarController was developed for a project I work on. Please feel free to reach me atpriankaliz@gmail.com

[翻译] NMBottomTabBarController的更多相关文章

  1. 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...

  2. 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...

  3. [翻译]开发文档:android Bitmap的高效使用

    内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...

  4. 【探索】机器指令翻译成 JavaScript

    前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...

  5. 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...

  6. 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...

  7. 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...

  8. 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?

    0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...

  9. ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点

    在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...

随机推荐

  1. git工具,conflict冲突解决方法

    这篇文章需要对git具有一定的了解,并且知道如何安装git工具(其实就是上git官网下载个文件,安装) git这种版本控制工具有什么好处 第一个,方便可以多人协同开发同一个项目或系统 第二个,当你系统 ...

  2. redis-java中的callback回掉机制

    springboot整合redis后, 会提供StringRedisTEmplate和 RedisTemplate 两个模板类供食用, 有时候这并不能满足我们的需求, 需要使用 connect 处理, ...

  3. SpringMVC异常处理机制

    SpringMVC异常处理机制 springMVC会将所有在doDispatch方法中的异常捕获,然后处理.无法处理的异常会抛出给容器处理. 在doDispatch()中调用processDispat ...

  4. 微服务 + Docker + Kubernetes 入门实践 目录

    微服务 + Docker + Kubernetes 入门实践: 微服务概念 微服务的一些基本概念 环境准备 Ubuntu & Docker 本文主要讲解在 Ubuntu 上安装和配置 Dock ...

  5. [PY3]——对iterator的处理(解析式、map、reduce、filter)

    引言 对iterator一般可以用for in方法处理,但有时可以借助更高效.也更易读的方式去处理. 例如解析式(包括列表解析式.生成器解析式.集合解析式.字典解析式), 例如map( ).reduc ...

  6. SpringMVC 之 Hello World 入门

    1 准备开发环境和运行环境 依赖 jar 包下载,如下图所示: 2 前端控制器的配置 在我们的web.xml中添加如下配置: <!-- The front controller of this ...

  7. c# 键值对照表

    虚拟键值表 虚拟键 十六进制值 十进制值 相应键盘或鼠标键 VK_LBUTTON 1 1 鼠标左键 VK_RBUTTON 2 2 鼠标右键 VK_CANCEL 3 3 Ctrl-Break键 VK_M ...

  8. vs2015 活动解决方案或项目由选择的源代码管理插件以外的插件管理

    1.vs2015切换源代码管理插件,svn无法切换到git,点击是将关闭项目 解决方案: 找到项目中.sln 文件,使用编辑器打开,将Svn-Managed = true 设置为false

  9. 页面刷新 location.reload()

    * 页面不刷新,但是加了location.reload()后,把炒作失败提示语都刷没了.//成功,不提示,刷新看数据变化ajax success:function(res){ if(res.code= ...

  10. Android全屏的两种方法

    在开发中我们经常需要把我们的应用设置为全屏,这里我所知道的有俩中方法,一中是在代码中设置,另一种方法是在配置文件里改! 一.在代码中设置: [java] view plain copy package ...