Latest 0.1.0
Homepage https://github.com/grandcentrix/GCXSteppedSlider
License MIT
Platforms ios 8.0
Authors

A custom UISlider implementation with tappable intermediate steps.

Demo

Installation

From CocoaPods

pod 'GCXSteppedSlider'

Usage

(Find sample project with integration in /Example)

GCXSteppedSlider is a custom UISlider implementation with intermediate steps that is nicely configurable.

- (void)viewDidLoad {
  [super viewDidLoad];

  NSArray* stepValues = @[@"First", @"Second", @(3), @(4), @(5)];
  self.stepValues = stepValues;
  UIImage* stepImage = [UIImage imageNamed:@"example"];
  GCXSteppedSlider* slider = [[GCXSteppedSlider alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 25.0) stepValues:stepValues initialStep:stepValues[2]];
  slider.disabledStepValues = @[@(3)];
  slider.delegate = self;
  slider.tintColor = [UIColor redColor];
  slider.signatureColor = [UIColor grayColor];
  [self.view addSubview:slider];
}

# pragma mark <GCXSteppedSliderDelegate>

- (UIImage*)steppedSlider:(GCXSteppedSlider *)slider stepImageForValue:(id)stepValue {
  return [UIImage imageNamed:@"example"];
}

- (void)steppedSlider:(GCXSteppedSlider *)slider valueChanged:(id)selectedValue {
  NSLog(@"slider value: %@", selectedValue);
}

- (CGSize)steppedSlider:(GCXSteppedSlider *)slider sizeForStepImageOfValue:(id)stepValue {
  if ([slider.disabledStepValues indexOfObject:stepValue] != NSNotFound) {
    return CGSizeMake(5.0, 5.0);
  } else if ([stepValue isEqual:self.stepValues.firstObject]) {
    return CGSizeMake(25.0, 25.0);
  } else if ([stepValue isEqual:self.stepValues.lastObject]) {
    return CGSizeMake(25.0, 25.0);
  }
  return CGSizeMake(15.0, 15.0);
}

Documentation

Maintainer

Please file Issues and do not contact maintainers directly. Thank you!

Latest podspec

{
    "name": "GCXSteppedSlider",
    "version": "0.1.0",
    "summary": "A custom UISlider implementation with tappable intermediate steps.",
    "description": "A custom, fully configurable UISlider implementation with tappable intermediate steps.",
    "homepage": "https://github.com/grandcentrix/GCXSteppedSlider",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Timo Josten": "[email protected]"
    },
    "source": {
        "git": "https://github.com/grandcentrix/GCXSteppedSlider.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "GCXSteppedSlider/Classes/**/*"
}

Pin It on Pinterest

Share This