Latest 0.1.1
Homepage https://github.com/Insofan/HXSegmentButton
License MIT
Platforms ios 8.0
Dependencies Masonry
Frameworks UIKit
Authors

CI Status
Version
License
Platform

Example

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

Requirements

Installation

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

pod "HXSegmentButton"

ScreenShot

CTuwV.gif

Usage

1.Setup SegmentButton
//1.Setup SegmentButton
- (HXSegmentButton *)segmentButton {
    if (!_segmentButton) {
        NSArray *array  = @[@"Button0", @"Button1", @"Button2", @"Button3"];
        CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
        //1.1 Setup segment button frame
        _segmentButton = [[HXSegmentButton alloc] initWithTitles:array x:0 y:64 width:screenWidth height:36];
        //1.2 Setup segment button colors
        [_segmentButton setupButtonsNormalColor:[UIColor whiteColor] selectedColor:[UIColor redColor]];
        //1.3 Setup segment button background colors and underLine color
        [_segmentButton setupBackgroundNormalColor:[UIColor blackColor] selectedColor:[UIColor yellowColor] underLineColor:[UIColor redColor]];
        [self.view addSubview:_segmentButton];
    }
    return _segmentButton;
}
2.Init button tag
 [self.segmentButton initButtonTagWith:0];
3. Receive the callback value
 //3.1Callback block
    __weak typeof(self) weakSelf = self;
    [_segmentButton returnHeaderIndex:^(NSUInteger current) {
        __strong typeof(weakSelf) strongSelf = weakSelf;
        NSLog(@"%ld", current);
        //3.2 Receive the button tag
        [strongSelf segmentButtonTag:current];
    }];
4.Setup UnderLine Animation
[self.segmentButton setupUnderLineAnimation];

Author

Insofan, [email protected]

License

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

Latest podspec

{
    "name": "HXSegmentButton",
    "version": "0.1.1",
    "summary": "A elegant segment button framework.",
    "description": "A elegant segment button framework.",
    "homepage": "https://github.com/Insofan/HXSegmentButton",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Insofan": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Insofan/HXSegmentButton.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "HXSegmentButton/Classes/**/*",
    "frameworks": "UIKit",
    "dependencies": {
        "Masonry": []
    }
}

Pin It on Pinterest

Share This