测试测试过的 | ✗ |
语言语言 | Obj-CObjective C |
许可 | MIT |
发布最后发布 | 2015年4月 |
由Michael Shkutkov维护。
SMVerticalSegmentedControl是一个简单的垂直分段控件(类似于UISegmentedControl)。该组件由HMSegementedControl启发。
属性 | 类型 | 默认值 |
---|---|---|
backgroundColor |
UIColor |
[UIColor clearColor] |
textFont |
UIFont |
[UIFont systemFontOfSize:14] |
textColor |
UIColor |
#000000 |
selectedTextColor |
UIColor |
#34B5E5 |
selectionIndicatorColor |
UIColor |
#000000 |
selectionIndicatorThickness |
CGFloat |
2 |
selectionBoxBackgroundColorAlpha |
CGFloat |
0.2 |
selectionBoxBorderColorAlpha |
CGFloat |
0.3 |
selectionBoxBorderWidth |
CGFloat |
1 |
segmentEdgeInset |
UIEdgeInsets |
{ 5, 5, 5, 5 } |
width |
CGFloat |
100 |
属性 | 类型 | 默认值 |
---|---|---|
selectionStyle |
SMVerticalSegmentedControlSelectionStyle |
SMVerticalSegmentedControlSelectionStyleTextHeightStrip |
selectionLocation |
SMVerticalSegmentedControlSelectionLocation |
SMVerticalSegmentedControlTextAlignmentLeft |
textAlignment |
SMVerticalSegmentedControlTextAlignment |
SMVerticalSegmentedControlTextAlignmentLeft |
SMVerticalSegmentedControl使用ARC。
在您的Podfile中添加pod 'SMVerticalSegmentedControl', '~> 0.1.2'
或手动将2个文件SMVerticalSegmentedControl.h
和SMVerticalSegmentedControl.m
添加到您的项目中。
NSArray *titles = @[@"Title 1", @"Title 2", @"Title 3", @"Title 4"];
SMVerticalSegmentedControl *segmentedControl = [[SMVerticalSegmentedControl alloc] initWithSectionTitles:titles];
[self.view addSubview:segmentedControl];
NSArray *titles = @[@"Title 1", @"Title 2", @"Title 3", @"Title 4"];
SMVerticalSegmentedControl *segmentedControl = [[SMVerticalSegmentedControl alloc] initWithSectionTitles:titles];
segmentedControl.selectedSegmentIndex = 3;
segmentedControl.textColor = [UIColor grayColor];
segmentedControl.selectedTextColor = [UIColor blackColor];
segmentedControl.textAlignment = SMVerticalSegmentedControlTextAlignmentCenter;
segmentedControl.selectionStyle = SMVerticalSegmentedControlSelectionStyleBox;
segmentedControl.selectionIndicatorThickness = 0;
segmentedControl.selectionBoxBorderWidth = 2;
segmentedControl.selectionBoxBackgroundColorAlpha = 0.5;
segmentedControl.selectionBoxBorderColorAlpha = 0.7;
segmentedControl.indexChangeBlock = ^(NSInteger index) {
//TODO: add handler
};
[self.view addSubview:segmentedControl];
//Customize the appearance of all vertical segmented control in you app
[SMVerticalSegmentedControl appearance].backgroundColor = [UIColor greyColor];
[SMVerticalSegmentedControl appearance].textColor = [UIColor whiteColor];
[SMVerticalSegmentedControl appearance].selectedTextColor = [UIColor blackColor];
[SMVerticalSegmentedControl appearance].selectionIndicatorColor = [UIColor redColor];
//Customize the appearance of vertical segmented control when they contained within a UIScrollView
[SMVerticalSegmentedControl appearanceWhenContainedIn:[UIScrollView class], nil].backgroundColor = [UIColor greyColor];
[SMVerticalSegmentedControl appearanceWhenContainedIn:[UIScrollView class], nil].textColor = [UIColor whiteColor];
[SMVerticalSegmentedControl appearanceWhenContainedIn:[UIScrollView class], nil].selectedTextColor = [UIColor blackColor];
[SMVerticalSegmentedControl appearanceWhenContainedIn:[UIScrollView class], nil].selectionIndicatorColor = [UIColor redColor];
SMVerticalSegmentedController在MIT许可下可用。
版权©2013 Michael Shkutkov
特此授予任何获得本软件及其相关文档文件(以下简称“软件”)副本的个人免费权限,前提是不得限制地处理软件,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本的权限,并允许将软件提供给他人以进行上述操作,但需遵守以下条件:
上述版权声明和本许可声明应包含在软件的任何副本或实质性部分中。
软件按“原样”提供,不提供任何形式的担保,无论是明示的、暗示的,还是与商业性、特定用途适用性或非侵权性相关的担保。在任何情况下,作者或版权所有者均不对任何索赔、损害或任何其他责任承担责任,无论基于合同、侵权或任何其他法律理论,无论是否与软件或软件的使用、或其他方式有关。