可定制的商品数量加减按钮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)
评论