CGSegmentBar 0.1.2

CGSegmentBar 0.1.2

Maintained by CodeGeekXu.



  • By
  • CodeGeekXu

CGSegmentBar

CI Status Version License Platform

CGSegmentBar

A view like UISegmentedControl,you can customize your style.

Installation

CGSegmentBar is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'CGSegmentBar'

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Usage

CGSegmentBar *dynamicSegmentBar = [[CGSegmentBar alloc]initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.bounds), 40)];
dynamicSegmentBar.titles = @[@"America",@"China",@"Japan",@"Germany",@"France",@"Italy",@"Spain",@"India"];
dynamicSegmentBar.widthStyle = CGSegmentBarWidthStyleDynamic;
dynamicSegmentBar.interitemSpacing = 30;
dynamicSegmentBar.paddingInsets = UIEdgeInsetsMake(0, 10, 0, 10);
dynamicSegmentBar.indicatorHeight = 2;
dynamicSegmentBar.indicatorColor = [UIColor blueColor];
[dynamicSegmentBar reload];
dynamicSegmentBar.didSelectItemBlock = ^(NSUInteger index) {
        
};
[self.view addSubview:dynamicSegmentBar];
    
[dynamicSegmentBar setSelectedIndex:2 animated:YES];

Author

CodeGeekXu, [email protected]

License

CGSegmentBar is available under the MIT license. See the LICENSE file for more info.