CategorySliderView 1.0.2

CategorySliderView 1.0.2

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最后发布2015年1月

Cem Olcay 维护。



  • Cem Olcay

水平或垂直滑块视图,用于选择分类。可以添加任何 UIView 类型的分类项目视图。完全可定制

示例

alt tag

用法

将 CategorySliderView.h/m 文件复制到您的项目中。

UILabel *category1 = ......
UILabel *category2 = ......
UILabel *category3 = ......
...

CategorySliderView *sliderView = [[CategorySliderView alloc] initWithSliderHeight:60 andCategoryViews:@[category1, category2, category3] categorySelectionBlock:^(UIView *categoryView, NSInteger categoryIndex) {
    UILabel *selectedView = (UILabel *)categoryView;
    NSLog(@"\"%@\" cateogry selected at index %d", selectedView.text, categoryIndex);
}];
[self.view addSubview:sliderView];

您可以添加任意数量的项目

UIView *newCategoryView = .....
[sliderView addCategoryView:newCategoryView];

可选属性

shouldAutoScrollSlider: scrolls to closest category item after dragging ends
shouldAutoSelectScrolledCategory: selects the closest category item after dragging ends
categoryViewPadding: padding between category item views
backgroundImage: background image for slider