A stepper with a sliding label in the middle.

Related tags

Stepper GMStepper
Overview

GMStepper

Version License Platform

A stepper with a sliding label in the middle. Pan the label or tap the buttons. Check out the tutorial, How to Build a Custom Stepper - Part 1.

Screenshot

Screenshot_1.gif

Usage

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

use_frameworks!
pod "GMStepper"

Setup

If you want to use storyboards, just drop a UIView into your storyboard and set its class to GMStepper. Then customize through the attributes inspector. Otherwise, you can write the code to initialize with frame and set the properties.

Properties

/// Current value of the stepper. Defaults to 0.
var value: Double = 0

/// Minimum value. Must be less than maximumValue. Defaults to 0.
var minimumValue: Double = 0

/// Maximum value. Must be more than minimumValue. Defaults to 100.
var maximumValue: Double = 100

/// Step/Increment value as in UIStepper. Defaults to 1.
var stepValue: Double = 1

/// The same as UIStepper's autorepeat. If true, holding on the buttons or keeping the pan gesture alters the value repeatedly. Defaults to true.
var autorepeat: Bool = true

/// If the value is integer, it is shown without floating point.
var showIntegerIfDoubleIsInteger: Bool = true

/// Text on the left button. Be sure that it fits in the button. Defaults to "-".
var leftButtonText: String = "-"

/// Text on the right button. Be sure that it fits in the button. Defaults to "+".
var rightButtonText: String = "+"

/// Text color of the buttons. Defaults to white
var buttonsTextColor: UIColor = UIColor.whiteColor()

/// Background color of the buttons. Defaults to dark blue.
var buttonsBackgroundColor: UIColor = UIColor(red:0.21, green:0.5, blue:0.74, alpha:1)

/// Font of the buttons. Defaults to AvenirNext-Bold, 20.0 points in size.
var buttonsFont = UIFont(name: "AvenirNext-Bold", size: 20.0)

/// Text color of the middle label. Defaults to white.
var labelTextColor: UIColor = UIColor.whiteColor()

/// Text color of the middle label. Defaults to lighter blue.
var labelBackgroundColor: UIColor = UIColor(red:0.26, green:0.6, blue:0.87, alpha:1)

/// Font of the middle label. Defaults to AvenirNext-Bold, 25.0 points in size.
var labelFont = UIFont(name: "AvenirNext-Bold", size: 25.0)

/// Corner radius of the middle label's layer. Defaults to 0.0.
var labelCornerRadius: CGFloat = 0.0

/// Corner radius of the stepper's layer. Defaults to 4.0.
var cornerRadius: CGFloat = 4.0

/// Border width of the stepper and middle label's layer. Defaults to 0.0.
var borderWidth: CGFloat = 0.0

/// Color of the border of the stepper and middle label's layer. Defaults to clear color.
var borderColor: UIColor = UIColor.clearColor()

/// Percentage of the middle label's width. Must be between 0 and 1. Defaults to 0.5. Be sure that it is wide enough to show the value.
var labelWidthWeight: CGFloat = 0.5

/// Color of the flashing animation on the buttons in case the value hit the limit.
var limitHitAnimationColor: UIColor = UIColor(red:0.26, green:0.6, blue:0.87, alpha:1)

Authors

License

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

Comments
  • Fix potential crash in background

    Fix potential crash in background

    I noticed that views containing GMStepper could cause a crash if the app was sent to the background after the view was initialized (e.g. loaded from nib) but before layoutSubviews() was called (e.g. view displayed). The crash happened on line 407 of reset() when it tried to access a nil implicitly unwrapped optional. Fixed by initializing labelOriginalCenter in setup() rather than waiting for layoutSubviews()

    opened by bwhtmn 6
  • Stepper value changed from 1

    Stepper value changed from 1

    I hace setup GMStepper in my UITableViewCell. In cellForRowAt indexPath method I am setting its textlable value like this: cell.stepper.label.text = String(receive_Cart[indexPath.row].quantity) value is displaying correctly.

    But when I changed its value by + or - it is not changing relative to value which I set in cellForRowAt indexPath.

    Example: The stepper label is set to 3. I have press + it should display 4 but it is displaying 2

    I have made a delegate of cell and function for stepper:

    func stepperValueChanged(cell: CartCell) {
    
        }
    
    opened by ibhavin 2
  • Swift 3 support

    Swift 3 support

    I have a test version ready on: https://github.com/Legoless/GMStepper/tree/Swift3

    But would not recommend merging into master, so can you maybe create another branch and I will submit a PR.

    opened by Legoless 2
  • GMStepper for iOS 7

    GMStepper for iOS 7

    Hey Günay, thank you for sharing this. It's really impressive work you've done. I'm interested in including your stepper in a project I am currently working on.

    Is it possible you would in the nearest future patch this up for iOS 7? Thank you once again.

    opened by zacwolff 2
  • How to know which button tapped Plus or Minus

    How to know which button tapped Plus or Minus

    Is there any way by which can we know that which button tapped Plus(+) or Minus(-). I want to perform specific action when user tapped Minus(-). I have made action of stepper like this:

    @IBAction func stepper_Item_Tapped(_ sender: GMStepper) {
        //
    }
    
    opened by ibhavin 1
  • Add borderWidth and borderColor properties

    Add borderWidth and borderColor properties

    This PR will help creating steppers with transparent background colors, borders and separators between buttons and middle label (similar to default iOS style). Please see attached screenshot below of the example project. Thanks for the library. gmstepperwithborder

    opened by luugiathuy 1
  • Carthage support

    Carthage support

    https://realm.io/news/swift-dependency-management-with-carthage/?utm_campaign=iOS%2BGameDev%2BWeekly&utm_medium=email&utm_source=iOS_GameDev_Weekly_41

    opened by gmertk 1
  • Dependency

    Dependency "ValueStepper" has no shared framework schemes

    Hi

    Updating carthage I am seeing the following. *** Skipped building ValueStepper due to the error: Dependency "ValueStepper" has no shared framework schemes

    Can you help please? Regards WTBM

    opened by WTBM 0
  • Reset timer when button touches are cancelled

    Reset timer when button touches are cancelled

    This fixes a weird behaviour that can happen if you touch and hold one of the buttons then go to a different screen. When you return the current screen that's showing a GMStepper, the value is still counting up/down continuously.

    opened by bwhtmn 0
  • Update minus sign character

    Update minus sign character

    Use the unicode “minus sign” symbol, instead of the “dash” from the classic keyboard.

    The difference isn’t visible on GitHub, or with most fixed-space fonts, but you can see the result when run on iOS.

    opened by vtourraine 0
  • Argument labels '(stringInterpolationSegment:)' do not match any available overloads

    Argument labels '(stringInterpolationSegment:)' do not match any available overloads

    Hi, I upgraded my application from Swift 4.2 to Swift 5 and I get an error. How do i fix this?

    File: GMStepper.swift

    Error: Argument labels '(stringInterpolationSegment:)' do not match any available overloads

    Error is in 2 areas.

    Area 1:

    else if isInteger { label.text = String(stringInterpolationSegment: "(Int(value))(self.suffixString)"/Int(value)/) } else { label.text = String(stringInterpolationSegment: "(value)(self.suffixString)"/value/) }

    Area 2:

    if self.showIntegerIfDoubleIsInteger && floor(self.value) == self.value { label.text = String(stringInterpolationSegment: "(Int(self.value))(self.suffixString)") } else { label.text = String(stringInterpolationSegment: "(Int(self.value))(self.suffixString)") }

    opened by 1tan1 3
  • Remove right border of left button and left border of right button

    Remove right border of left button and left border of right button

    I have to remove the right border of the left button and left a border of the right button. How I can implement this? Because I can't see any code of that. You're setting frames directly.

    opened by AbhishekJ17 0
  • How to have formatted text on the middle label ?

    How to have formatted text on the middle label ?

    how can I have formatted text on the middle label when user clicks on the incrementer? For an example "Tag 1", "Tag 2" --> 1, 2 will be incremented or decremented in a normal way.

    opened by ktkanishka 0
May be the most elegant stepper you have ever had!

PFStepper It may be the most elegant stepper you have ever had! Usage To be written. Todo Documenting @IBDesignable supporting Animations Customizable

null 25 Dec 16, 2019
A Stepper object that displays its value.

ValueStepper Description ValueStepper is an improved replication of Apple's UIStepper object. The problem with UIStepper is that it doesn't display th

Patrick Balestra 364 Dec 28, 2022
LabeldStepper - A native SwiftUI stepper that shows the current value and has more features

LabeledStepper A native SwiftUI Stepper that shows the value with more features!

Seyed Mojtaba Hosseini Zeidabadi 10 Nov 2, 2022
SuperStepper - Super Stepper in SwiftUI

SuperStepper Example To run the example project, clone the repo, and run pod ins

Chanwoo Cho 15 Sep 7, 2022
A stepper with a sliding label in the middle.

GMStepper A stepper with a sliding label in the middle. Pan the label or tap the buttons. Check out the tutorial, How to Build a Custom Stepper - Part

Günay Mert Karadoğan 916 Dec 18, 2022
Stepper-View - Stepper view using with UICollectionView with Custom animation & Transation

Stepper view using with UICollectionView with Custom animation & Transation. ??

mohamed gamal 3 Jun 28, 2022
Animated Mask Label is a nice gradient animated label.

Animated Mask Label Demo Screen Screenshot Demo/Example For demo: $ pod try AnimatedMaskLabel To run the example project, clone the repo, and run pod

Jogendra 19 Dec 13, 2022
Alignment Control is a component to align top, middle, bottom, left, center, right.

AlignmentControl is a component for alignment Direction AlignmentDirection Horizontal Vertical Mode AlignmentMode Left Center Right Top Middle Bottom

Beslan Tularov 38 Mar 16, 2022
SwiftUI library to create fully customizable input stepper.

SwiftUI-InputStepper Swift package for creating numerical input stepper. An example of input stepper created with this library It supports long press

Mateusz Budnik 4 Nov 2, 2022
May be the most elegant stepper you have ever had!

PFStepper It may be the most elegant stepper you have ever had! Usage To be written. Todo Documenting @IBDesignable supporting Animations Customizable

null 25 Dec 16, 2019
A Stepper object that displays its value.

ValueStepper Description ValueStepper is an improved replication of Apple's UIStepper object. The problem with UIStepper is that it doesn't display th

Patrick Balestra 364 Dec 28, 2022
LabeldStepper - A native SwiftUI stepper that shows the current value and has more features

LabeledStepper A native SwiftUI Stepper that shows the value with more features!

Seyed Mojtaba Hosseini Zeidabadi 10 Nov 2, 2022
SuperStepper - Super Stepper in SwiftUI

SuperStepper Example To run the example project, clone the repo, and run pod ins

Chanwoo Cho 15 Sep 7, 2022
Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more.

IQKeyboardManager While developing iOS apps, we often run into issues where the iPhone keyboard slides up and covers the UITextField/UITextView. IQKey

Mohd Iftekhar Qurashi 15.9k Jan 8, 2023
Panels is a framework to easily add sliding panels to your application

Panels is a framework to easily add sliding panels to your application. It takes care of the safe area in new devices and moving your panel when the k

Antonio Casero 1.5k Dec 14, 2022
An implementation of the sliding menu found in various iOS apps.

IIViewDeckController ViewDeck is a framework to manage side menus of all kinds. It supports left and right menus and manages the presentation of the s

ViewDeck 5.3k Dec 20, 2022
A sliding Sheet from the bottom of the Screen with 3 States build with SwiftUI.

BottomSheet A sliding Sheet from the bottom of the Screen with 3 States build with SwiftUI. Why There have been many different attempts to recreate th

Lucas Zischka 639 Jan 3, 2023
⬆️ A SwiftUI view component sliding in from bottom

⬆️ A SwiftUI view component sliding in from bottom

Tieda 595 Dec 28, 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
💀 An easy way to create sliding CAGradientLayer animations! Works great for creating skeleton screens for loading content.

Skeleton is an easy way to create sliding CAGradientLayer animations! It works great for creating skeleton screens: ??‍?? Usage The entire library com

Gonzalo Nuñez 668 Nov 2, 2022