Customizable animated slider for iOS

Overview

MMSegmentSlider

Pod Platform Pod License Pod Version Carthage compatible Travis build

MMSegmentSlider is an easy-to-use IBDesignable animated slider for iOS 7+ written in Objective-C.

MMSegmentSlider

Installation

From CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like MMSegmentSlider in your projects. First, add the following line to your Podfile:

pod 'MMSegmentSlider'

If you want to use the latest features of MMSegmentSlider use normal external source dependencies.

pod 'MMSegmentSlider', :git => 'https://github.com/MedvedevMax/MMSegmentSlider'

This pulls from the master branch directly.

Second, install MMSegmentSlider into your project:

pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

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

github "MedvedevMax/MMSegmentSlider"

Run carthage update to build the framework and drag the built MMSegmentSlider.framework (in Carthage/Build/iOS folder) into your Xcode project (Linked Frameworks and Libraries in Targets).

Manually

  • Drag the MMSegmentSlider folder into your project.
  • Enjoy it

Usage

(see sample Xcode project in /demo)

MMSegmentSlider is completely IBDesignable and IBInspectable. This means you can customise it right in the Interface Builder and see the changes immediately.

MMSegmentSlider

Interface Builder

The simplest way to use MMSegmentSlider is to add an empty view and set the class to MMSegmentSlider. Then you can customise its appearance right in the Attribute Inspector. Though you should note that the font for labels can only be customised from the code:

segmentSlider.labelsFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:14.0f];

Using the code

You can also instantiate MMSegmentSlider like any other UIControl right from the code and use the following properties to change the look of the slider:

@property (nonatomic, strong) UIColor *basicColor;
@property (nonatomic, strong) UIColor *labelColor;
@property (nonatomic, strong) UIColor *selectedValueColor;
@property (nonatomic, strong) UIColor *selectedLabelColor;
@property (nonatomic) NSInteger circlesRadius;
@property (nonatomic) NSInteger textOffset;
@property (nonatomic, strong) UIFont *labelsFont;

Values and labels

To set values for items use:

segmentSlider.values = @[@"$19", @"$99", @"$199", @"$299"];

This values are not visible and will only be returned when you retrieve the selected value:

priceLabel.text = (NSString *)segmentSlider.currentValue;

To set labels for these values use:

segmentSlider.labels = @[@"1 month", @"6 months", @"1 year", @"2 years"];

You can also get the index of the selected item using the following property:

@property (nonatomic) NSInteger selectedItemIndex;

Note that it's not readonly, so you can change current value using it. If you want to animate changing use this method instead:

- (void)setSelectedItemIndex:(NSInteger)selectedItemIndex animated:(BOOL)animated;

License

MMSegmentSlider is distributed under the terms and conditions of the MIT license.

Credits

MMSegmentSlider is brought to you by Max Medvedev. If you're using MMSegmentSlider in your project, attribution would be very appreciated.

You might also like...
A custom reusable circular / progress slider control for iOS application.
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

iOS 11 Control Center Slider
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

An iOS-16-styled slider.

Slyderin An iOS-16-styled slider. Available on iOS 13 and later. Slyderin.Demo.mov How to Use Include it with Swift Package Manager. Add it to your vi

🎚️ 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.

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.

A reusable Slider View made with SwiftUI
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

Custom & highly configurable seek slider with sliding intervals, disabled state and every possible setting to tackle!
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

TriggerSlider is a simple SwiftUI trigger slider
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

VolumeControl is a custom volume control for iPhone featuring a well-designed round slider.
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

Simple and light weight slider with chapter management
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

Comments
  • Couldn't save the position of the circle in uitableview

    Couldn't save the position of the circle in uitableview

    On placing MMSegment on a uitableview, I could save the state of the value changed but not the position of the circle, refer screenshot screen shot 2016-08-26 at 5 38 41 pm The selected value is Sometime, but the position of the circle is at NO. How to solve this ? This happens when I scroll the uitableview up or down

    opened by khanxc 2
  • Error IB Designables, Failed to render and Failed to update layout

    Error IB Designables, Failed to render and Failed to update layout

    I have xcode8 and MMSegmentSlider version 1.0.2 I have errors compiling

    IB Designables: Failed to render and update auto layout status for UIView (i5M-Pr-FkT): Failed to load designables from path (null) Failed to update auto layout status: Failed to load designables from path (null)

    opened by popularizan 2
Owner
Max Medvedev
iOS Developer. Telegram @ maxmedvedev
Max Medvedev
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
A custom reusable slider control with 2 thumbs (range slider).

MARKRangeSlider A custom reusable slider control with 2 thumbs (range slider). Values range is between minimumValue and maximumValue (from 0 to 1 by d

Vadym Markov 181 Nov 21, 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
Dragger - A Customizable Drag Slider swiftUI view

Dragger A customizable SwiftUI Dragger view. Installation In Xcode add https://g

Kiefer Wiessler 4 Dec 19, 2022
VerticalSlider - An animatable and customizable vertical slider written in Swift 4

VerticalSlider An animatable and customizable vertical slider written in Swift 4. Quick Start VerticalSliderPlayground Clone Repo Open VSVerticalSlide

Vincent Smithers 13 Apr 26, 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
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
An iOS Slider written in Swift.

JDSlider Beetripper App's screenshots Example Project To run the example project, clone the repo, and run pod install from the Example directory first

Jelly Development 84 Jul 26, 2022
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
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