GoSegmentedControl 1.1

GoSegmentedControl 1.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Jun 2017

Maintained by zjmdp.



  • By
  • zjmdp

GoSegmentedControl provides fully customizable and scrollable segmented control.

#ScreenShot Screenshot

Installation

###CocoaPods

pod 'GoSegmentedControl', '~> 0.7'

###Manually

  1. Downloads the source files in directory GoSegmentedControl/Classes.
  2. Add the source files to your project.
  3. import "GoSegmentedControl.h" in your files.

Usage

Create GoSegmentedControl

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];

Implement GoSegmentedControlDataSource

- (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;
}

Implement GoSegmentedControlDelegate

- (CGFloat)segmentedControl:(GoSegmentedControl *)segmentedControl widthForSegmentAtIndex:(NSInteger)index{
    return 50;
}

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Credits

  • zjmdp

License

MIT license