TintingButton 介绍
TintingButton 是 UIButton 的子类,利用 tintColor 和 UIImage 渲染模式。
All Colored mode
let btnShare = TintingButton(completelyTintedWith: .whiteColor(), activeTintColor: .greenColor()) btnShare.setimage(imageShare, forState: UIControlState.normal) btnShare.setTitle(title, forState: UIControlState.normal)
Title Image Colored mode
let btnShare = TintingButton(titleAndImageTintedWith: whiteColor(), activeTintColor: .greenColor()) btnShare.setimage(imageShare, forState: UIControlState.normal) btnShare.layer.borderColor = .grayColor().CGColor btnShare.layer.borderWidth = 1 btnShare.setTitle(title, forState: UIControlState.normal)