Latest 1.1
Homepage https://github.com/zjmdp/GoSegmentedControl
License MIT (LICENSE)
Platforms ios 7.0
Authors

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

Latest podspec

{
    "name": "GoSegmentedControl",
    "version": "1.1",
    "summary": "GoSegmentedControl provides fully customizable and scrollable segmented control.",
    "description": "GoSegmentedControl provides fully customizable and scrollable segmented control with neat APIs.",
    "homepage": "https://github.com/zjmdp/GoSegmentedControl",
    "license": "MIT (LICENSE)",
    "authors": {
        "zjmdp": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/zjmdp/GoSegmentedControl.git",
        "tag": "1.1"
    },
    "source_files": [
        "Classes",
        "Classes/**/*.{h,m}"
    ],
    "exclude_files": "Classes/Exclude"
}

Pin It on Pinterest

Share This