[翻译] NMBottomTabBarController

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

时间: 2024-09-08 11:28:26

[翻译] NMBottomTabBarController的相关文章

[翻译]JDK 8 兼容性指南

翻译官方文档,删除部分可忽略. 译者:坤谷,井桐,激酶 兼容性是一个复杂的问题. 本文介绍了Java平台潜在的三种不兼容问题: 源码: 源码兼容性问题关注Java源代码转换成class文件是否兼容,包括代码是否仍然可编译. 二进制: 在Java语言规范中,二进制兼容性定义为:"类的改变是二进制兼容的(或者不破坏二进制兼容性),是指如果改变前的类的二进制在链接时没有错误,那么改变后的类在链接时仍然没有错误." 行为 : 行为兼容性包括在运行时执行的代码的语义. 欲了解更多信息,请参阅Op

java.security.Guard翻译

  Overview Package  Class Use Tree Deprecated Index Help JavaTM 2 PlatformStd. Ed. v1.4.2  PREV CLASS   NEXT CLASSFRAMES    NO FRAMES     All Classes SUMMARY: NESTED | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD java.security Interface Gua

翻译CFSSL相关操作文档

我发现国内这个CFSSL资料蛮少的. 但如果深入到K8S认证之后,这块知识又必不可少. (OPENSSL也可实现,但好像不是主流) 于是花了两天快速翻译了一下几个文档. 贡献给有需要的同仁. 如有错误(肯定有!),欢迎提正. 百度网盘共享地址: https://pan.baidu.com/s/1skAQtAH

如何这段C#代码翻译成VB代码?谢谢!

问题描述 如何这段C#代码翻译成VB代码?谢谢! private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { //自动点击弹出确认或弹出提示 IHTMLDocument2 vDocument = (IHTMLDocument2)webBrowser1.Document.DomDocument; vDocument.parentWindow.execScrip

php-java和PHP有纯中文的官方手册吗?还是只有部分的翻译?

问题描述 java和PHP有纯中文的官方手册吗?还是只有部分的翻译? java和PHP有纯中文的官方手册吗?还是只有部分的翻译?我英文不好,能不能学呢? 解决方案 http://cn2.php.net/manual/zh/index.php 解决方案二: java的JDK有中文版的API,PHP网上也有中文手册.现在网络资源这么丰富,只有肯上心,学东西还是很容易的. 选定一个完整的视频教程,跟着练习,上手是很容易的. 我就是2010年暑假跟着传智播客视频教程自学的Java,现在已经很熟练了.祝好

傲游浏览器怎么翻译网页

  步骤一:没有傲游浏览器的童鞋 步骤二:点开下拉====勾选"翻译". 步骤三:输入你想要的翻译的网址,选定你想翻译的内容 步骤四:耐心等待翻译结果

Word 2010中的“翻译字典”

  1.打开一篇文字文档,并且里面与你有需要翻译的文字,例如,我们这里先选择一篇中文散文; 2.在功能区点击"审阅"选项卡,选择"语言"区域的"翻译"选项组,单击"翻译所选文字"; 3.单击"审阅"功能卡,点击"语言"区域的"翻译"选项组,在弹出的下拉菜单中选择"选择转换语言"; 4.此时窗口会弹出一个"翻译语言选项"的对话框,

Word每一页的左边显示英语右边显示中文翻译

  现在,您想实现的效果是,在每一页里面,左边是英文,右边是对应的翻译好的中文.像这样的排版方式,可以方便我们更好的学习英语. ①使用分栏的是不科学的 要解决这个问题,很多人第一时间就会想到分栏,想把英文放在栏的左边,中文放在栏的右边.然而,这是可行的,却是不科学的. 因为,使用Word里面的自动分栏,原文英文和翻译后的中文,很难一一对应,造成学习上的困难.另外,如果您想再排版实现一一对应,那么,难度是非常大. ②使用文本框也是不合理的 以上方法难以实现.很多人会想到使用文本框的办法. 即在Wo

360浏览器如何翻译英文网页

  整个网页翻译: 1.打开360浏览器,在浏览器中打开你想浏览的英文网站,选择浏览器上面的翻译三角符号. 2.选择第一项,翻译当前网页,就会开始翻译了. 3.翻译完后,就可以看到全部是中文了. 单个句子翻译: 1.同样选择浏览器上面的翻译,选择第二项翻译文字. 2.在弹出的翻译对话框中,将要翻译的英文复制到文本框中,点击下面的翻译. 3.翻译完后,翻译的结果就在下面了,很方便的.