- Quickly customize the relative position of the picture and text buttons
- Quickly customize the basic information of color, picture and other basic buttons
- Support for setting relative text and image spacing in xib
To run the example project, clone the repo, and run pod install from the Example directory first.
EasyCustomButton is available through CocoaPods. To install it, simply add the following line to your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'TargetName' do
pod 'EasyCustomButton' , '1.0.1'
end
Then, run the following command:
$ pod install
- Quickly customize a normal style button:
let button = EasyCustomButton.init(title: "测试", titleColor: .black, titleFont: UIFont.systemFont(ofSize: 20), image: UIImage(named: "haowu_home"), backgroundColor: .red)
view.addSubview(button)
Or:
let button = EasyCustomButton.init(titleColor: .black, titleFont: UIFont.systemFont(ofSize: 20), image: UIImage(named: "haowu_home"), backgroundColor: .red)
button.setTitle("测试", for: .normal)
view.addSubview(button)
- Quickly customize the relative position of the picture and text buttons
let button = EasyCustomButton.init(imagePostionStyle: .left, midSpacing: 20, title: "测试", titleColor: .black, titleFont: UIFont.systemFont(ofSize: 20), image: UIImage(named: "haowu_home"), backgroundImage: nil, backgroundColor: .green)
button.frame = CGRect(x: 100, y: 100, width: 200, height: 40)
view.addSubview(button)
Or setting relative text and image spacing in xib
xiaohualao, zengjing@sdiread.com
EasyCustomButton is available under the MIT license. See the LICENSE file for more info.