CocoaPods trunk is moving to be read-only. Read more on the blog, there are 17 months to go.

FitButton 1.1.2

FitButton 1.1.2

Maintained by nilongchang.



FitButton 1.1.2

  • By
  • nilongchang

FitButton

CI Status Version License Platform

Example

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

Requirements

Installation

FitButton is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'FitButton'
  // FitButton继承于UIButton, 所有的用法和UIButton一致, 主要增加2个属性
  // spacing 图片和文字的间距
  // imagePosition 图片位置
  // imageSize 图片大小
  
    let button = FitButton(type: .custom)
    // 设置图片和文字的间距
    button.spacing = 10
    // 设置图片位置
    button.imagePosition = .bottom
    // 设置图片大小
    button.imageSize = CGSize(width: 40, height: 40)

    // 正常UIButton的设置
    button.setTitle("FitButton", for: .normal)
    button.setTitleColor(UIColor.black, for: .normal)
    button.setImage(UIImage(named: "read"), for: .normal)
    button.layer.borderWidth = 1
    button.layer.borderColor = UIColor.black.cgColor
    button.contentEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)

License

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