Skip to content

GoSegmentedControl provides fully customizable and scrollable segmented control.

License

Notifications You must be signed in to change notification settings

zjmdp/GoSegmentedControl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoSegmentedControl

Version License Platform

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

About

GoSegmentedControl provides fully customizable and scrollable segmented control.

Resources

License

Stars

Watchers

Forks

Packages

No packages published