A custom reusable slider control with 2 thumbs (range slider).

Overview

MARKRangeSlider

Version License Platform

A custom reusable slider control with 2 thumbs (range slider). Values range is between minimumValue and maximumValue (from 0 to 1 by default). The left thumb isn't able to go on the right side of the right thumb, and vice versa. Control enables multitouch (to use 2 fingers at 2 thumbs at the same time).

Please check Demo project for a basic example on how to use MARKRangeSlider.

Demo

Alt text

Available control properties

  • minimumValue - the minimum value of the slider's range (readonly)
  • maximumValue - the maximum value of the slider's range (readonly)
  • leftValue - the value of the left thumb (readonly)
  • rightValue - the value of the right thumb (readonly)
  • minimumDistance - the distance between 2 thumbs (thumbs can't be closer to each other than this distance)
  • pushable - allows the user to push both controls
  • disableOverlapping - disables the overlaping of thumb controls
  • sendInstantUpdates - allows the user to select between instant updates and after completing drag of thumb

Available control methods

  • (void)setMinValue:(CGFloat)minValue maxValue:(CGFloat)maxValue
  • (void)setLeftValue:(CGFloat)leftValue rightValue:(CGFloat)rightValue

Available styling properties

Images are customizable, default ones are used when no image is provided.

  • trackImage - track background image
  • rangeImage - range background image
  • leftThumbImage - left thumb image
  • rightThumbImage - right thumb image

Usage

In your View Controller

- (void)viewDidLoad {
    // ...
    self.rangeSlider = [[MARKRangeSlider alloc] initWithFrame:CGRectZero];
    [self.rangeSlider addTarget:self
                         action:@selector(rangeSliderValueDidChange:)
               forControlEvents:UIControlEventValueChanged];

    [self.rangeSlider setMinValue:0.0 maxValue:1.0];
    [self.rangeSlider setLeftValue:0.2 rightValue:0.7];

    self.rangeSlider.minimumDistance = 0.2;

    [self.view addSubview:self.rangeSlider];
    // ...
}

- (void)rangeSliderValueDidChange:(MARKRangeSlider *)slider {
    NSLog(@"%0.2f - %0.2f", slider.leftValue, slider.rightValue);
}

Installation

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

pod 'MARKRangeSlider'

Author

Vadym Markov, [email protected]

License

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

Comments
  • Make the thumb image view size equal to image size

    Make the thumb image view size equal to image size

    Problem: even if the thumb image is quite big the image view frame remains 32x32 (as bundle image). Therefore we cannot easily pan the thumb. This PR changes the image view frame sizes. And fixes https://github.com/vadymmarkov/MARKRangeSlider/issues/25 Thanks.

    opened by vvit 3
  • trackImage is nil when using cocoapods + use_frameworks

    trackImage is nil when using cocoapods + use_frameworks

    When specifying use_frameworks! in Podfile, all the resources are located in a separate framework bundle, so [UIImage imageNamed:] returns nil. This can be fixed with 2 ways - fast and the right way =)

    1. replace imageNamed: with imageNamed:inBundle:compatibleWithTraitCollection: (works only ios8+)
    2. create a separate resource bundle with images and reference it in code
    opened by Sega-Zero 3
  • Do not set left value

    Do not set left value

    If i set left value first and then right, left value will still be not set. Code below works but if i set left value first it will be 1

    _ageSlider.minimumValue = 14.0;
    _ageSlider.maximumValue = 99.0;
    _ageSlider.rightValue = 28.0;
    _ageSlider.leftValue = 18.0;
    _ageSlider.minimumDistance = 1.0;
    
    [_ageSlider addTarget:self
                   action:@selector(rangeSliderValueDidChange:)
         forControlEvents:UIControlEventValueChanged];
    
    [self updateRangeText];
    
    opened by andwhy 3
  • UITableViewCell subView MARKRangeSlider issue

    UITableViewCell subView MARKRangeSlider issue

    Hi whenever, we are dragging, the table view controller is popping up to previous view controller so how could we handle such scenario? I mean how to stop from popping back to previous view controller?

    opened by SyedHyder1988 2
  • Left value always starts from 0

    Left value always starts from 0

    I installed Mark Range Slider and in it I gave the slider.minimumValue = 15 and leftValue as 20. But when i started scrolling it showed the left value to be 0 which was quite surprising. I noticed that for each and every minimum value the code returns the starting value from 0. I tried a lot to understand and fix the issue but it didn't work. I have implemented this party and willing to continue this . Please fix this issue as soon as possible because I can not afford to be late regarding this issue.

    opened by kunalgupta1593 2
  • Weird handle under the left handle

    Weird handle under the left handle

    Works great except for a strange thing (see below). There's a second handle under the left most handle. Not doing anything special - just copied and pasted code from github to init the slider.

    screen shot 2015-07-19 at 12 43 29 am
    opened by etayluz 2
  • Pushable thumb controls and disabling overlapping

    Pushable thumb controls and disabling overlapping

    I had some use cases for pushable controls and disabling overlapping of the thumb controls, thought you might want to merge them in. Pushing: pushable Overlapping: overlap

    opened by Arrnas 2
  • Source files seem to conflict with the license

    Source files seem to conflict with the license

    The license.md file in the repo states that the code is under MIT license but the actual source files contain "Copyright (c) 2015 Vadym Markov. All rights reserved.".

    The latter is probably the XCode default?

    opened by mkoppanen 2
  • trackImage

    trackImage

    Hello,

    how does one actually change the track or range image?

    It seems that the image set during setUpViewComponents and changing the "trackImage" property doesn't change the image currently being used in trackImageView.

    opened by mkoppanen 2
  • fix that the slider shows the right thumb's position incorrectly, whe…

    fix that the slider shows the right thumb's position incorrectly, whe…

    fix that the slider shows the right thumb's position incorrectly, when the left value & right value is zero

    *precondition : the slider's left value is not zero.

    opened by Urtaq 1
  • Dragging thumb for custom image only works for top half

    Dragging thumb for custom image only works for top half

    If I use a custom Thumb image, tapping and dragging the thumb only works if the tap started from the middle to the top of the thumb. If you tap at the bottom of the thumb, it doesn't work.

    Video: https://youtu.be/M9O1J0AIm3Q

    opened by gmogames 1
  • Add stepping value

    Add stepping value

    Hi there,

    It would be nice if you could define the stepping value. so if for instance the steppingValue is 1, then the slider would go 10, 11, 12, etc... instead of 10.1, 10.2, etc...

    Or if the stepping value is 10, then it goes 10, 20, 30, etc...

    Otherwise, great slider!

    opened by gmogames 2
Releases(1.1.1)
  • 1.1.1(Jan 23, 2017)

  • 1.1.0(May 9, 2016)

  • 1.0.1(Jan 28, 2016)

  • 1.0.0(Dec 26, 2015)

    • Fix double initialisation.
    • Use image height as track height.
    • Drop hardcoded image insets.
    • Calculate intrinsicContentSize.
    • New way of setting minimum/maximum and left/right values.
    • Load images from a bundle.
    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(May 11, 2015)

Owner
Vadym Markov
iOS Software Engineer
Vadym Markov
A custom reusable circular / progress slider control for iOS application.

HGCircularSlider Example To run the example project, clone the repo, and run pod install from the Example directory first. You also may like HGPlaceho

Hamza Ghazouani 2.4k Jan 4, 2023
A simple range slider made in Swift

RangeSlider Summary A simple range slider made in Swift. Screenshot Use This control is IBDesignable and uses the target-action pattern for change not

William Archimede 305 Nov 29, 2022
A slider, similar in style to UISlider, but which allows you to pick a minimum and maximum range.

TTRangeSlider A slider, similar in style to UISlider, but which allows you to pick a minimum and maximum range. Installation TTRangeSlider is availabl

Tom Thorpe 952 Dec 2, 2022
RangeSeedSlider provides a customizable range slider like a UISlider.

RangeSeekSlider Overview RangeSeekSlider provides a customizable range slider like a UISlider. This library is based on TomThorpe/TTRangeSlider (Objec

WorldDownTown 644 Dec 12, 2022
A reusable Slider View made with SwiftUI

ZSlider A reusable Slider View made with SwiftUI. Installation: Minimum version iOS 13 In Xcode go to File -> Swift Packages -> Add Package Dependency

null 7 Dec 15, 2022
VolumeControl is a custom volume control for iPhone featuring a well-designed round slider.

#VolumeControl VolumeControl is a custom volume control for iPhone featuring a well-designed round slider. Preview Usage // Include VolumeControl.h in

12Rockets 81 Oct 11, 2022
PhotoSlider is a simple photo slider and can delete slider with swiping.

PhotoSlider is a simple photo slider and can delete slider with swiping.

Daichi Nakajima 247 Nov 30, 2022
This is an iOS Tweak that modifies the brightness slider in the Control Center.

AdvancedBrightnessSlider Tweak This is an iOS Tweak that modifies the brightness slider in the Control Center. Even with dark mode toggled on, I found

Jonas Schiefner 18 Jan 5, 2023
A beautiful slider control for iOS built purely upon Swift

SnappingSlider A beautiful slider control for iOS. Installation There are two ways to add the control to your project; you can add it as a submodule i

Rehat Kathuria 577 Dec 15, 2022
A feature-rich circular slider control written in Swift.

MTCircularSlider Screenshot Usage To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 1

Eran Boudjnah 132 Jan 1, 2023
VerticalSlider is a vertical slider control for iOS in Swift.

?? VerticalSlider If you like VerticalSlider, give it a ★ at the top right of this page. Overview VerticalSlider is a vertical implementation of the U

Jon Kent 78 Sep 15, 2022
iOS 11 Control Center Slider

SectionedSlider Control Center Slider Requirements Installation Usage License Requirements iOS 8.0+ Swift 3.0+ Xcode 8.0+ Installation CocoaPods Cocoa

Leonardo Cardoso 361 Dec 3, 2022
Custom & highly configurable seek slider with sliding intervals, disabled state and every possible setting to tackle!

iLabeledSeekSlider Custom & highly configurable seek slider with sliding intervals, disabled state and every possible setting to tackle! Minimum iOS v

Edgar Žigis 9 Aug 16, 2022
StepSlider its custom implementation of slider such as UISlider for preset integer values.

StepSlider StepSlider its custom implementation of slider such as UISlider for preset values. Behind the scenes StepSlider manipulate integer indexes.

spromicky 520 Dec 20, 2022
🎚️ STDiscreteSlider – slider which allows user to choose value only from predefined set of data.

STDiscreteSlider – slider which allows user to choose value only from predefined set of data. Slider may receive any types of options, you may pass set of integers or strings, or any other type. Written using SwiftUI.

Tamerlan Satualdypov 15 Apr 3, 2022
TriggerSlider is a simple SwiftUI trigger slider

TriggerSlider is a simple SwiftUI trigger slider which can be used instead of a button, e.g. in a situation where the

Dominik Butz 4 Dec 16, 2022
Use UIResponder to imitate an iOS slider.

WWSlider Use UIResponder to imitate an iOS slider. 使用UIResponder仿造一個iOS的滑桿. Installation with Swift Package Manager dependencies: [ .package(url:

William-Weng 2 May 5, 2022
Simple and light weight slider with chapter management

Simple and light weight slider with chapter management Demo Installation CocoaPods WESlider is available through CocoaPods. To install it, simply add

Lucas Ortis 89 Nov 29, 2022
IntervalSlider is a slider library like ReutersTV app. written in pure swift.

IntervalSlider Description and appetize.io`s DEMO To run the example project, clone the repo, and run pod install from the Example directory first. Re

Nobuyasu 65 May 23, 2021