TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Nov 2015 |
SPMSupports SPM | ✗ |
Maintained by SuguruKishimoto.
Light-weight, no use image check button.
UIControl
.@IBInspectable
. You can change color, border in Storyboard.@IBDesignable
. You can see check button in storyboardSUCheckButton is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "SUCheckButton"
and run
pod install
SUCheckButton
Attribute Inspector
and change it.
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.
MIT license. See the LICENSE file for more info.