Latest 0.1.2
Homepage https://github.com/Wildog/WDScrollableSegmentedControl
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Minimal segmented control, scrollable, customizable, animatable, easy as hell to use.

Works perfectly with YTPageController:

Screenshot

Usage

Interface Builder is all you need:

IB

… or you prefer code:


WDScrollableSegmentedControl *segmentedControl = [[WDScrollableSegmentedControl alloc] initWithFrame:frame];

// space between buttons
segmentedControl.padding = 10.;

// space before first button and after last button
segmentedControl.edgeMargin = 0.;

// indicator height
segmentedControl.indicatorHeight = 3.;

// indicator animation duration
segmentedControl.indicatorMoveDuration = 0.25;

// font
segmentedControl.font = [UIFont systemFontOfSize:16.];

// colors
segmentedControl.indicatorColor = [UIColor blackColor];
segmentedControl.buttonColor = [UIColor blackColor];
segmentedControl.buttonHighlightColor = [UIColor grayColor];
segmentedControl.buttonSelectedColor = [UIColor blueColor];

// use this method if you want to change colors dynamically
[segmentedControl setButtonColor:[UIColor greenColor] forState:UIControlStateNormal];

Finally set the data and delegate:

scrollSegment.buttons = @[@"Foo", @"Button 1", @"Button 2", @"Another Button", @"Bar", @"Button Again", @"Finally"];
scrollSegment.delegate = self;

// this is what your delegate should implement
- (void)didSelectButtonAtIndex:(NSInteger)index;

If you use it in a navigation controller, don’t forget to set:

self.automaticallyAdjustsScrollViewInsets = NO;

Or it will mess with contentSize of the segmented control.

Example

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

Requirements

iOS 8.0 or above.

Installation

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

pod "WDScrollableSegmentedControl"

Author

Wildog, [email protected]

License

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

Latest podspec

{
    "name": "WDScrollableSegmentedControl",
    "version": "0.1.2",
    "summary": "Minimal segmented control, scrollable, customizable, animatable, easy as hell to use.",
    "description": "Minimal segmented control, scrollable, customizable, animatable, easy as hell to use.",
    "homepage": "https://github.com/Wildog/WDScrollableSegmentedControl",
    "screenshots": [
        "https://raw.githubusercontent.com/Wildog/WDScrollableSegmentedControl/master/screenshot.gif",
        "https://raw.githubusercontent.com/Wildog/WDScrollableSegmentedControl/master/ibinspectable.png"
    ],
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Wildog": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Wildog/WDScrollableSegmentedControl.git",
        "tag": "0.1.2"
    },
    "social_media_url": "https://twitter.com/WildogGo",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "WDScrollableSegmentedControl/Classes/**/*"
}

Pin It on Pinterest

Share This