[翻译] DZNSegmentedControl
DZNSegmentedControl

A drop-in replacement for UISegmentedControl for showing counts, to be used typically on a user profile.
一个UISegmentedControl的子类,用以扩展UISegmentedControl的功能,可以用在展示用户的信息上.

Features
- Customizable control with tint color, font, sizes and animation duration. 可以定制填充颜色,字体,尺寸以及动画的方向
- Animated and width auto-adjusting selection indicator. 可以做动画以及自动适应.
- UIBarPositioning support. 支持UIBarPositioning
- UIAppearance support. 支持UIAppearance
- ARC & 64bits. ARC 以及 64位
Installation
Available in Cocoa Pods
你可以使用Cocoa Pods安装
pod 'DZNSegmentedControl'
How to use
For complete documentation, visit CocoaPods' auto-generated doc
你可以参考文档 visit CocoaPods' auto-generated doc
Step 1
Import "DZNSegmentedControl.h"
导入头文件
Step 2
Creating a new instance of DZNSegmentedControl is very similar to what you would do with UISegmentedControl:
创建出 DZNSegmentedControl 对象,与创建 UISegmentedControl 类似:
NSArray *items = @[@"Tweets", @"Following", @"Followers"];
DZNSegmentedControl *control = [[DZNSegmentedControl alloc] initWithItems:items];
control.tintColor = [UIColor blueColor];
control.delegate = self;
control.selectedSegmentIndex = 1;
[control addTarget:self action:@selector(selectedSegment:) forControlEvents:UIControlEventValueChanged];
You can additionally set more properties:
你还可以设置额外的一些属性:
[control setCount:@(12) forSegmentAtIndex:0];
[control setTitle:@"Hello" forSegmentAtIndex:1];
[control setEnabled:NO forSegmentAtIndex:2];
Sample project
Take a look into the sample project. Everything is there.
你也可以参考一下示例项目.
[翻译] DZNSegmentedControl的更多相关文章
- 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...
- 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...
- [翻译]开发文档:android Bitmap的高效使用
内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...
- 【探索】机器指令翻译成 JavaScript
前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...
- 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...
- 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...
- 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...
- 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?
0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...
- ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点
在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...
随机推荐
- git --mixed --soft --hard之间的区别
git reset --mixed:此为默认方式,不带任何参数的git reset,即时这种方式,它回退到某个版本,只保留源码,回退commit和add信息git reset --soft:回退到某个 ...
- 初始设置ubuntu 16.04 Vps部署rails
参考 https://blog.longwin.com.tw/2005/12/ssh_keygen_no_passwd/ 1 选择搬瓦工左边菜单栏中的“Root password modificati ...
- PHP之string之chr()函数使用
chr (PHP 4, PHP 5, PHP 7) chr - Return a specific character chr - 返回指定的字符 Description string chr ( i ...
- minStack实现
设计包含 min 函数的栈(栈)定义栈的数据结构,要求添加一个 min 函数,能够得到栈的最小元素.要求函数 min.push 以及 pop 的时间复杂度都是 O(1). #include <a ...
- 微软URLRewriter.dll的url重写的简单使用
1.先下载MSDNURLRewriting.zip包,打开代码生成URLRewriter.dll文件: 2.将URLRewriter.dll文件引用到项目中: 3.在web.config文件中 &l ...
- CSS- 文本超出指定宽度后隐藏并显示为省略号
一般的文字截断(适用于内联与块): .text-overflow { display:block;/*内联对象需加*/ width:25em; word-break:keep-all;/* 不换行 * ...
- mysql 最小配置 及 安装
[mysqld] # 设置3306端口 port= # 设置mysql的安装目录 basedir=D:\-Installer\-MySQL\mysql--winx64 # 设置mysql数据库的数据的 ...
- DataSet常用简单方法
Clear移除表中所有行来清除任何数据的DataSet Clone赋值该DataSet的结构但不复制数据 Copy赋值DataSet的结构和数据 Dispose释放DataSet对象 Equals确定 ...
- Toolstrip 工具栏控件
工具栏是另一种获取应用程序主要功能的常用方法,比起菜单更直观. Tool strip 控件是由system.Windows.forms.Toolstrip类提供的,作用是创建易于自定义的常用工具栏 ...
- Laravel trait的使用
trait 是在PHP5.4中为了方便代码复用的一种实现方式,但目前我在看的的PHP项目中较少看的有程序员去主动使用这个实现方式,在laravel中有很多 trait 的使用,关于trait 在 la ...