SubmitButton iOS 动画提交按钮组件 项目简介
SubmitButton 是一组iOS 动画提交按钮,采用Swift开发。效果图:使用环境:swift2 +xcode7.3 +使用:1 创建一个按钮using code let frame = CGRect(x: 50, y: 100, width: 200, height: 60)
button = SubmitButton(frame: frame)
button.setTitle("Submit", forState: .Normal)
self.view.addSubview(button)using Storyboard or XIB2 (Optional) 按钮属性设置 btn.checkLineWidth = 6.0
btn.progressBorderWidth = 5.0
btn.successColor = UIColor(red:0, green:206/255, blue:148/255, alpha:1)
btn.progressColor = UIColor(red:0, green:206/255, blue:148/255, alpha:1)3 (Optional) 按钮statechanged回调 btn1.stateChanged = {
(toState:SubmitButtonState) in
if toState == .Loading { self.btn1.progress = 1
}
}4 改变按钮状态@IBAction func btnClicked(sender: AnyObject) { let btn = sender as! SubmitButton if btn.submitState != .Normal {
btn.changeState(.Normal)
} else {
btn.changeState(.Loading)
}
}5 设置进度 ...
btn.progress = 1
...
button = SubmitButton(frame: frame)
button.setTitle("Submit", forState: .Normal)
self.view.addSubview(button)using Storyboard or XIB2 (Optional) 按钮属性设置 btn.checkLineWidth = 6.0
btn.progressBorderWidth = 5.0
btn.successColor = UIColor(red:0, green:206/255, blue:148/255, alpha:1)
btn.progressColor = UIColor(red:0, green:206/255, blue:148/255, alpha:1)3 (Optional) 按钮statechanged回调 btn1.stateChanged = {
(toState:SubmitButtonState) in
if toState == .Loading { self.btn1.progress = 1
}
}4 改变按钮状态@IBAction func btnClicked(sender: AnyObject) { let btn = sender as! SubmitButton if btn.submitState != .Normal {
btn.changeState(.Normal)
} else {
btn.changeState(.Loading)
}
}5 设置进度 ...
btn.progress = 1
...