/EasyCustomButton

EasyCustomButton

Primary LanguageSwiftMIT LicenseMIT

EasyCustomButton

CI Status Version License Platform

Features

  • 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

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

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

Usage

  1. 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)
  1. 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

Author

xiaohualao, zengjing@sdiread.com

License

EasyCustomButton is available under the MIT license. See the LICENSE file for more info.