标签:
DZNSegmentedControl
A drop-in replacement for UISegmentedControl for showing counts, to be used typically on a user profile.
一个UISegmentedControl的子类,用以扩展UISegmentedControl的功能,可以用在展示用户的信息上.
Features
Available in Cocoa Pods
你可以使用Cocoa Pods安装
pod ‘DZNSegmentedControl‘
For complete documentation, visit CocoaPods‘ auto-generated doc
你可以参考文档 visit CocoaPods‘ auto-generated doc
Import "DZNSegmentedControl.h"
导入头文件
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];
Take a look into the sample project. Everything is there.
你也可以参考一下示例项目.
标签:
原文地址:http://www.cnblogs.com/YouXianMing/p/4532795.html