Swiftpack.co - Package - spromicky/StepSlider

StepSlider

StepSlider its custom implementation of slider such as UISlider for preset values. Behind the scenes StepSlider manipulate integer indexes. Its based on drawing directlyon CAShapeLayer.

Usage

You can add StepSlider right from code with any of standard initialisers. Or you can add it directly on your storybord. Its fully IBDesignable and IBInspetable compatible.

StepSlider *slider = [[StepSlider alloc] initWithFrame:CGRectMake(10.f, 200.f, 300.f, 44.f)];
[slider setMaxCount:10];
[slider setIndex:2];
[self.view addSubview:slider];

StepSlider can be fully customised by any of this properties:

  • trackHeight
  • trackCircleRadius
  • sliderCircleRadius
  • dotsInteractionEnabled
  • trackColor
  • sliderCircleColor
  • sliderCircleImage

Supports haptic feedback on valueChanged:.

Labels

From version 1.0.0 StepSlider support labels near each circle on track.

slider.labels = @[@"Some string", @"another string", @"one more"];

slider.adjustLabel - set first and last label to exactly to frame left and right.

From version 1.8.0 StepSlider support NSAttributedString as label text.

Images

For 1.2.0 and higher you can use images for sliderCircle and trackCircles. For trackCircles supported two states: normal and selected.

[self.sliderView setTrackCircleImage:[UIImage imageNamed:@"unselected_dot"] forState:UIControlStateNormal];
[self.sliderView setTrackCircleImage:[UIImage imageNamed:@"selected_dot"] forState:UIControlStateSelected];

Requirements

  • version 1.3.0 and above needs iOS 10.0+
  • version 1.2.1 supports iOS 7.0+

Installation

CocoaPods

To integrate StepSlider into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'StepSlider', '~> 1.3.0'

Then, run the following command:

$ pod install

Carthage

To integrate StepSlider into your Xcode project using Carthage, specify it in your Cartfile:

github "spromicky/StepSlider" ~> 1.3.0

Run carthage update to build the framework and drag the built StepSlider.framework into your Xcode project.

Swift Package Manager

Start 1.8.0 StepSlider can be integrated in your Xcode project. When adding new package search StepSlider and select version 1.8.0 or above.

Manual Installation

Just copy StepSlider class to your project.

License

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

Github

link
Stars: 367

Dependencies

Used By

Total: 0

Releases

NSAttributedString as labels - 2020-10-10 21:58:59

Added support for NSAttributedString as labels. Also contains fix for iOS14 bug with resources (#47)

Fix crash with fast sliding - 2020-06-18 14:26:02

Copy path property to prevent using of dealloc variable.

Prevents other gestures - 2020-02-22 09:00:12

Fix #40

New circle animation - 2019-09-19 14:58:19

Rewrote circle animations for dot interaction. Deleted stupid dispatch schedule for animation. That make animation smoother and fix crash from #21(for intensive clicking on different circles).

Added defaults - 2018-12-29 11:53:58

Added defaults to initWithCoder:.

Haptic feedback - 2018-11-08 16:11:22

Added haptic feedback. Disabled by default. As a result minimal deployment target changed to iOS 10.

Label color fix. - 2018-07-05 08:20:40

Images for track circles. - 2018-06-22 13:04:45

From now you can use images for track circles customization. Currently supported two states: normal and selected. Also as a bonus adding Carthage support.

Multilines support - 2017-11-19 15:13:56

  • support multilines text;
  • fix issue with same labels count redraw.

- 2017-03-06 11:19:29

  • fix issue with early return in layoutSubview.

- 2017-01-23 08:16:11

  • fix issue with no constraints.
  • fix crash with with setting maxCount, when labels is already set.

Labels support. - 2017-01-15 12:07:36

  • add support for labels;
  • fully customised labels;
  • fix animation of StepSlider;

Slider circle as image. - 2016-11-06 14:29:30

  • add ability to set image as slider circle.
  • fix issue with disabled interaction for slider circle.