All Projects → yonat → MultiToggleButton

yonat / MultiToggleButton

Licence: MIT license
Multiple state tap-to-toggle UIButton (like old camera flash button)

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to MultiToggleButton

Closures
Swifty closures for UIKit and Foundation
Stars: ✭ 1,720 (+2023.46%)
Mutual labels:  uibutton
toggle
Vue 3 toggle component with labels, custom slots and styling options (+Tailwind CSS support).
Stars: ✭ 75 (-7.41%)
Mutual labels:  toggle
pidswallow
A swallower script using process hierarchy.
Stars: ✭ 40 (-50.62%)
Mutual labels:  toggle
Jztvosparallaxbutton
📺 tvOS Button with Parallax Effect (ObjC)
Stars: ✭ 161 (+98.77%)
Mutual labels:  uibutton
onscroll-effect
A tiny JavaScript library to enable CSS animations when user scrolls.
Stars: ✭ 35 (-56.79%)
Mutual labels:  toggle
react-toggle
A React UI Component to display an awesome Toggle Button control
Stars: ✭ 17 (-79.01%)
Mutual labels:  toggle
Zfripplebutton
Custom UIButton effect inspired by Google Material Design
Stars: ✭ 1,416 (+1648.15%)
Mutual labels:  uibutton
ng-toggle
Bootstrap-styled Angular Toggle Component
Stars: ✭ 14 (-82.72%)
Mutual labels:  toggle
togglific
Do you find web animations distracting? Togglific provides a distraction-free web experience!
Stars: ✭ 17 (-79.01%)
Mutual labels:  toggle
ALRadioButtons
RadioButtons for iOS. Inherited from UIControl, support 2 native styles, fully customizable.
Stars: ✭ 65 (-19.75%)
Mutual labels:  uibutton
Lgbutton
A fully customisable subclass of the native UIControl which allows you to create beautiful buttons without writing any line of code.
Stars: ✭ 2,216 (+2635.8%)
Mutual labels:  uibutton
PickerButton
PickerButton is subclass of UIButton that presents UIPickerView in UIKeyboard.
Stars: ✭ 41 (-49.38%)
Mutual labels:  uibutton
react-slide-toggle
React component re-implementation for jQuery.slideToggle feature
Stars: ✭ 42 (-48.15%)
Mutual labels:  toggle
Speechrecognizerbutton
UIButton subclass with push to talk recording, speech recognition and Siri-style waveform view.
Stars: ✭ 144 (+77.78%)
Mutual labels:  uibutton
AnimatedButton
UIButton subclass which performs animation on selection
Stars: ✭ 16 (-80.25%)
Mutual labels:  uibutton
Emspinnerbutton
UIButton sublcass with loading animation
Stars: ✭ 117 (+44.44%)
Mutual labels:  uibutton
RCPickerButton
Simple button for marking some items as selected.
Stars: ✭ 17 (-79.01%)
Mutual labels:  uibutton
wp-showhide
Allows you to embed content within your blog post via WordPress ShortCode API and toggling the visibility of the cotent via a link.
Stars: ✭ 21 (-74.07%)
Mutual labels:  toggle
PygameWidgets
A module for use with Pygame. Includes fully customisable buttons, textboxes, sliders and many more, as well as the ability to create and run animations on these widgets.
Stars: ✭ 34 (-58.02%)
Mutual labels:  toggle
ld-redux
A library to integrate launch darkly with react redux
Stars: ✭ 33 (-59.26%)
Mutual labels:  toggle

Multiple State Toggle UIButton

A UIButton subclass that implements tap-to-toggle button text. (Like the camera flash and timer buttons)

Swift Version Build Status License CocoaPods Compatible
Platform PRs Welcome

Usage

Just create it with the states, and it's good to go:

let toggleButton = MultiToggleButton(image: myImage, states: ["First", "Second", "Last"])

Get and set the current state:

let state = toggleButton.currentStateIndex
toggleButton.currentStateIndex = 0

Add a tap action (in addition to the built-in state toggle):

toggleButton.action = { (sender) -> () in
    doStuff(sender.currentStateIndex)
}

Set different colors for different states (nil uses the button's tintColor):

toggleButton.colors = [nil, .gray, .red]

Set different images for different states:

toggleButton.images = [myFirstImage, mySecondImage, myLastImage]

Or do it all at once:

let toggleButton = ToggleButton(
    images: [myFirstImage, mySecondImage, myLastImage],
    states: ["First", "Second", "Last"],
    colors: [nil, .gray, .red],
    action: { (sender) -> () in doStuff(sender.currentStateIndex) }
)

Installation

CocoaPods:

pod 'MultiToggleButton'

Legacy versions:

Swift version MultiToggleButton version
4.0 (Xcode 9.4) pod 'MultiToggleButton', '~> 1.7.1'
3 pod 'MultiToggleButton', '~> 1.5.2'
2.3 pod 'MultiToggleButton', '~> 1.4.0'

Swift Package Manager:

dependencies: [
    .package(url: "https://github.com/yonat/MultiToggleButton", from: "1.8.2")
]

Meta

@yonatsharon

https://github.com/yonat/MultiToggleButton

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].