Latest 0.1.2
Homepage https://github.com/sgr-ksmt/SUCheckButton
License MIT
Platforms ios 8.0, requires ARC
Authors

Version
License
Platform

Light-weight, no use image check button.

screenshot1

Features

  • This class is subclass of UIControl.
  • Equip @IBInspectable. You can change color, border in Storyboard.
  • Equip @IBDesignable. You can see check button in storyboard
  • Animate when button pressed.(scale animation)
  • Immediately update when property changed.

Requirements

  • Xcode 7.0
  • Swift 2.0 (2.1 is not fully compatible)

Installation

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

pod "SUCheckButton"

and run

pod install

Usage

Use in Storyboard

  • Add view in storyboard
  • Change Class to SUCheckButton
  • If you want to change color,border width,etc.. , open Attribute Inspector and change it.

Use in code


import SUCheckButton

// Use convenience initializer
let checkButton = SUCheckButton() // make default frame: {0, 0, 30, 30}

// Use normal initializer
let checkButton = SUCheckButton(frame: CGRectMake(0, 0, 44, 44))

// change color
checkButton.checkedFillColor = UIColor(red: 1.0, green: 0.2, blue: 0.1, alpha: 1.0)

// did press handler
checkButton.didPressHandler = { (checked: Bool) in
    print("status : (checked)")
}
// also use addTarget:action:forControlEvents:
checkButton.addTarget(self, action: "checkValueChanged:", forControlEvents: .ValueChanged)

If use just mark (not use as a buton), set userInteractionEnabled = false

checkButton.userInteractionEnabled = false

checkButton.checked = true // status : checked. change mark.
checkButton.checked = false // status : unchecked. change mark.

License

MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SUCheckButton",
    "version": "0.1.2",
    "summary": "light-weight check button in Swift.",
    "description": "light-weight check button in Swift.nEquip @IBInspectable, @IBDesignable.nSUCheckButton is Subclass of UIControl.",
    "homepage": "https://github.com/sgr-ksmt/SUCheckButton",
    "screenshots": "https://raw.githubusercontent.com/sgr-ksmt/SUCheckButton/master/screenshots/screenshot1.png",
    "license": "MIT",
    "authors": {
        "Suguru Kishimoto": "[email protected]"
    },
    "source": {
        "git": "https://github.com/sgr-ksmt/SUCheckButton.git",
        "tag": "0.1.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "SUCheckButton": [
            "Pod/Assets/*.png"
        ]
    }
}

Pin It on Pinterest

Share This