Latest 1.1.0
Homepage https://github.com/HituziANDO/MKAToggleButton
License MIT
Platforms ios 9.3, requires ARC
Authors

MKAToggleButton is multiple icons toggle button for iOS.

MKAToggleButtonMKAToggleButtonMKAToggleButtonMKAToggleButton

Include in your iOS app

CocoaPods

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

pod "MKAToggleButton"

Manual Installation

  1. Downloads latest MKAToggleButton
  2. Drags & Drops MKAToggleButton.framework into your Xcode project

Quick Usage

  1. Imports the module

    Swift

    import MKAToggleButton

    Objective-C

    #import <MKAToggleButton/MKAToggleButton.h>
  2. Creates an instance and sets up

    Swift

    // Creates an instance with icon images.
    let toggleButton = MKAIconToggleButton(images: [UIImage(named: "circle")!,
                                                    UIImage(named: "square")!,
                                                    UIImage(named: "triangle")!,
                                                    UIImage(named: "star")!])
    self.view.addSubview(toggleButton)
    
    // Should use click handler for user interaction.
    toggleButton.clickHandler = { sender in
        if let button = sender as? MKAIconToggleButton {
            // `currentStateIndex` property returns the current state.
            print("index=(button.currentStateIndex)")
        }
    }

    Objective-C

    TBA

    Or Sets up in the Storyboard

    1. Sets MKAIconToggleButton class to Custom Class field in the storyboard

      MKAToggleButton

    2. Sets multiple image file names separated by commas to Image Names field

      MKAToggleButton

Template Rendering Mode

When the template mode is enabled, the toggle button applies its tintColor to the icon images.

Swift

// Uses the template rendering mode and sets a color to `tintColor`.
toggleButton.isImageTemplate = true
toggleButton.tintColor = UIColor(red: 241.0 / 255.0, green: 196.0 / 255.0, blue: 15.0 / 255.0, alpha: 1.0)

Objective-C

TBA


More info, see my sample code.

Latest podspec

{
    "name": "MKAToggleButton",
    "version": "1.1.0",
    "summary": "MKAToggleButton is multiple icons toggle button for iOS.",
    "description": "MKAToggleButton is multiple icons toggle button for iOS.",
    "homepage": "https://github.com/HituziANDO/MKAToggleButton",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Hituzi Ando": "[email protected]"
    },
    "platforms": {
        "ios": "9.3"
    },
    "source": {
        "git": "https://github.com/HituziANDO/MKAToggleButton.git",
        "tag": "1.1.0"
    },
    "source_files": "MKAToggleButton/**/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This