https://github.com/daisuke-t-jp/llaeasybutton
LLAEasyButton is class for easy use of UIButton.
https://github.com/daisuke-t-jp/llaeasybutton
carthage cocoapods swift uibutton uibutton-subclass
Last synced: 6 months ago
JSON representation
LLAEasyButton is class for easy use of UIButton.
- Host: GitHub
- URL: https://github.com/daisuke-t-jp/llaeasybutton
- Owner: daisuke-t-jp
- License: mit
- Created: 2019-01-26T04:45:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-26T08:31:48.000Z (about 7 years ago)
- Last Synced: 2025-01-26T12:15:21.436Z (over 1 year ago)
- Topics: carthage, cocoapods, swift, uibutton, uibutton-subclass
- Language: Swift
- Homepage:
- Size: 7.18 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
------

[](https://developer.apple.com/swift)
[](https://github.com/Carthage/Carthage)
[](https://cocoapods.org/pods/LLAEasyButton)
[](https://travis-ci.org/daisuke-t-jp/LLAEasyButton)

# What is this?
*LLAEasyButton* 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/LLAEasyButton"`
### CocoaPods
```
use_frameworks!
target 'target' do
pod 'LLAEasyButton'
end
```
# Works at Interface Builder
### 1. Set view
Open Interface Builder.
Select **UIView** and put to superview.
(**Not UIButton**)
### 2. Change class
Rename UIView’s class name to *LLAEasyButton*.
### 3. Add label (If you need)
If you need to label.
Put UILabel to LLAEasyButton’s subview hierarchy.
### 4. Set IBOutlet
You set LLAEasyButton IBOutlet on swift code.
### 5. Connect IBOutlet
Interface Builder object connet to IBOutlet.
# Usage
### 1. Set normal/selected color on enable state
``` swift
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
``` swift
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
``` swift
button?.subviewLabel()?.text = "button"
button?.subviewLabel()?.textColor = UIColor.blue
```