Latest 1.0.9
Homepage https://github.com/pmick/NXTSegmentedControl
License MIT
Platforms ios , requires ARC
Authors

Pod Version Travis Status

The styled swipeable segmented control used in Next

NXTSegmentedControl

Installation

Either manually add the NXTSegmentedControl.h/m files to your project, or add the NXTSegmentedControl cocoapod by adding the following line to your podfile:

pod 'NXTSegmentedControl'

Usage

Start by importing the header.

#import <NXTSegmentedControl/NXTSegmentedControl.h>

Create the segmented control, and customize the appearance.

NXTSegmentedControl *segmentedControl = [[NXTSegmentedControl alloc] initWithItems:@[@"Post", @"Comments"]];
segmentedControl.tintColor = [UIColor redColor];
[segmentedControl addTarget:self action:@selector(segmentedControlValueChanged:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview: segmentedControl];

Finally implement your action method.

- (void)segmentedControlValueChanged:(id)sender {
    NXTSegmentedControl *segmentedControl = (NXTSegmentedControl *)sender;
    NSString *t = [NSString stringWithFormat:@"%d", segmentedControl.selectedSegmentIndex];
    NSLog(t);
}

NXTSegmentedControl uses the target action pattern just like most controls from UIKit. This creation code should be nearly identical to UISegmentedControl creation.

Latest podspec

{
    "name": "NXTSegmentedControl",
    "version": "1.0.9",
    "summary": "A segmented control replacement that supports swiping, and animated transitions.",
    "homepage": "https://github.com/pmick/NXTSegmentedControl",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Patrick Mick": "[email protected]"
    },
    "social_media_url": "http://twitter.com/patrickmick",
    "platforms": {
        "ios": null
    },
    "source": {
        "git": "https://github.com/YayNext/NXTSegmentedControl.git",
        "tag": "1.0.9"
    },
    "source_files": [
        "Classes",
        "NXTSegmentedControl/*.{h,m}"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This