LLASwiftyEasyButton 1.0.3

LLASwiftyEasyButton 1.0.3

Maintained by Daisuke T.




  • By
  • daisuke-t-jp


Platform Language Swift%204.2 Carthage compatible Cocoapods Build Status


Concept

LLASwiftyEasyButton is class for easy use of UIButton.
The class can set normal/selected color. Also easy use button's label.

Install

Carthage

github "daisuke-t-jp/LLASwiftyEasyButton"

CocoaPods

platform :ios, '10.0'
use_frameworks!

target 'target' do
pod 'LLASwiftyEasyButton'
end

Works at Interface Builder

1. Set view



Open Interface Builder.
Select UIView and put to view.
(Not UIButton)

2. Change class


Rename UIView’s class name to LLASwiftyEasyButton.

3. Add Label (If you need)



If you need to label.
Put UILabel to LLASwityEasyButton’s subview hierarchy.

4. Set IBOutlet


You set LLASwityEasyButton IBOutlet on swift code.

5. Connect IBOutlet




Interface Builder object connet to IBOutlet.

Usage

1. Set normal/selected color on enable state

button?.colorMapEnable = [.normal: UIColor.init(red: 239/255, green: 154/255, blue: 154/255, alpha: 1.0),
                        .selected: UIColor.init(red: 244/255, green: 67/255, blue: 54/255, alpha: 1.0)]

2. Set normal/selected color on disable state

button?.colorMapDisable = [.normal: UIColor.init(red: 239/255, green: 154/255, blue: 154/255, alpha: 1.0),
                        .selected: UIColor.init(red: 244/255, green: 67/255, blue: 54/255, alpha: 1.0)]

3. Set button's label text

button?.subviewLabel()?.text = "button"
button?.subviewLabel()?.textColor = UIColor.blue