PPNumberButtonSwift可定制的商品数量加减按钮swift版
可定制的商品数量加减按钮 PPNumberButton 是OC版,swift版的自定义程度和功能与OC版一致;详细介绍
支持cocoaPods导入,欢迎Star!
Usage 使用方法
1.默认样式
let numberButton = PPNumberButtonSwift.init(frame: CGRect(x: 100, y: 100, width: 110, height: 30))//开启抖动动画numberButton.shakeAnimation(true)//加减按钮的闭包回调numberButton.numberResult { (number) in print(number) } view.addSubview(numberButton)
2.边框样式
let numberButton = PPNumberButtonSwift.init(frame: CGRect(x: 100, y: 160, width: 200, height: 30))//设置边框颜色numberButton.borderColor(UIColor.grayColor())//加减按钮的闭包回调numberButton.numberResult { (number) in print(number) } view.addSubview(numberButton)
3.自定义加减按钮的标题
let numberButton = PPNumberButtonSwift.init(frame: CGRect(x: 100, y: 220, width: 150, height: 44))//设置加减按钮的标题numberButton.setTitle(decreaseTitle: "加", increaseTitle: "减")//设置加减按钮标题的字体大小numberButton.buttonTitleFont(UIFont.systemFontOfSize(15))//开启抖动动画numberButton.shakeAnimation(true)//加减按钮的闭包回调numberButton.numberResult { (number) in print(number) } view.addSubview(numberButton)
4.自定义加减按钮的背景图片
let numberButton = PPNumberButtonSwift.init(frame: CGRect(x: 100, y: 300, width: 100, height: 30))//设置加减按钮的自定义图片numberButton.setImage(decreaseImage: UIImage.init(named: "decrease_highlight")!, increaseImage: UIImage.init(named: "timeline_relationship_icon_addattention-1")!)//开启抖动动画numberButton.shakeAnimation(true)//加减按钮的闭包回调numberButton.numberResult { (number) in print(number) } view.addSubview(numberButton)
评论