CocoaPods trunk is moving to be read-only. Read more on the blog, there are 3 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Jan 2017 |
Maintained by Zeyu Tao.
HTSegmentsView 对一组子控件进行“单选”状态管理,并且支持选中状态的切换与动画。
HTSegmentsView *segmentsView = [[HTHorizontalSegmentsView alloc] initWithSelectedIndex:0];
segmentsView.frame = CGRectMake(30,100,260,50);
segmentsView.segmentsDelegate = self;
注意:segmentsView内部对datasource是弱引用,使用者需要保证datasource的生命周期。
HTStringToLabelDataSource *dataSource = [[HTStringToLabelDataSource alloc] initWithArray:@[@"button1",@"button2",@"button3"] segmentCellClass:nil];
segmentsView.segmentsDataSource = dataSource;
HTSublineSegmentViewAnimator *animator = [[HTSublineSegmentViewAnimator alloc] initWithSegmentsView:segmentsView backgroundColor:[UIColor lightGrayColor] lineColor:[UIColor greenColor] lineHeight:5];
segmentsView.animator = animator;
HTSegmentsView是继承自UIScrollView,为了避免NavigationController导致的-64的contentOffset问题,需要将HTSegmentsView所在的ViewController的automaticallyAdjustsScrollViewInsets属性设置为NO,或者在合适的时间将修改掉HTSegmentsView的contentOffset值。
该项目最低支持iOS 7.0和Xcode 7.0
HTSegmentsView使用MIT许可证,详情见LICENSE文件。