Latest 0.9.1
Homepage https://github.com/GlobakMaxim/GMSegmentedControl
License MIT
Platforms ios 8.0, requires ARC
Authors
  • Customization
  • Swipeable
  • Nullable (Able to deselect segment)

Sample

Usage

  NSArray *segments = @[@"First", @"Second", @"Third"];

  GMSegmentedControl *segmentedControl = [[GMSegmentedControl alloc] initWithSegments:segments];
  segmentedControl.frame = CGRectMake(0, 0, 300, 40);
  segmentedControl.center = self.view.center;
  segmentedControl.cornerType = GMSegmentedControlCornerTypePill;
  segmentedControl.backgroundColor = [UIColor greenColor];
  segmentedControl.borderColor = [UIColor greenColor];
  segmentedControl.tintColor = [UIColor whiteColor];
  [segmentedControl addTarget:self
                       action:@selector(segmentedControlValueChanged:)
             forControlEvents:UIControlEventValueChanged];

  [self.view addSubview:segmentedControl];

Default settings

  self.clipsToBounds = YES;
  self.selectedSegmentIndex = NSNotFound;
  self.cornerType = GMSegmentedControlCornerType_default;
  self.backgroundColor = [UIColor clearColor];
  self.tintColor = [UIColor greenColor];
  self.animationDuration = 0.1;
  self.selectedItemTextColor = [UIColor darkGrayColor];

Corner radius

typedef NS_ENUM(NSInteger, GMSegmentedControlCornerType) {
  GMSegmentedControlCornerTypeDefault,    // cornerRadius = 0
  GMSegmentedControlCornerTypeRounded1,   // cornerRadius = 4
  GMSegmentedControlCornerTypeRounded2,   // cornerRadius = 8
  GMSegmentedControlCornerTypePill,       // cornerRadius = half height
};

Latest podspec

{
    "name": "GMSegmentedControl",
    "version": "0.9.1",
    "summary": "Customization, swipeable, nullable segmented control",
    "homepage": "https://github.com/GlobakMaxim/GMSegmentedControl",
    "screenshots": "https://github.com/GlobakMaxim/GMSegmentedControl/blob/master/sample.gif?raw=true",
    "description": "Segmented control wich you needed =)",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": {
        "Globak Maxim": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/GlobakMaxim/GMSegmentedControl.git",
        "tag": "0.9.1"
    },
    "source_files": [
        "GMSegmentedControl",
        "GMSegmentedControl/**/*.{h,m}"
    ],
    "exclude_files": "GMSegmentedControl/Exclude",
    "requires_arc": true
}

Pin It on Pinterest

Share This