GoSegmentedControl
provides fully customizable and scrollable segmented control.
###CocoaPods
pod 'GoSegmentedControl', '~> 0.7'
###Manually
- Downloads the source files in directory
GoSegmentedControl/Classes
. - Add the source files to your project.
- import
"GoSegmentedControl.h"
in your files.
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;
}
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
- zjmdp
MIT license