GoSegmentedControl
提供了完全可自定义和可滚动的分段控件。
###CocoaPods
pod 'GoSegmentedControl', '~> 0.7'
###手动安装
GoSegmentedControl/Classes
目录下的源文件。"GoSegmentedControl.h"
。GoSegmentedControl *segmentedControl = [[GoSegmentedControl alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([UIScreen mainScreen].bounds), 50)];
segmentedControl.delegate = self;
segmentedControl.dataSource = self;
segmentedControl.selectionIndicatorHeight = 3;
segmentedControl.indicatorMargin = 4.f;
segmentedControl.selectionIndicatorColor = [UIColor grayColor];
- (NSInteger)numberOfSegmentsInGoSegmentedControl:(GoSegmentedControl *)segmentedControl{
return 10;
}
- (UIView *)segmentedControl:(GoSegmentedControl *)segmentedControl customSegmentViewAtIndex:(NSInteger)index{
UILabel *label = [UILabel new];
[label setText:[NSString stringWithFormat:@"Segment: %@", @(index)]];
return label;
}
- (CGFloat)segmentedControl:(GoSegmentedControl *)segmentedControl widthForSegmentAtIndex:(NSInteger)index{
return 50;
}
git checkout -b my-new-feature
git commit -am '添加一些功能'
git push origin my-new-feature
MIT 许可证