- 初始化一个按钮
let downloadButtonView = DownloadButtonView.init(frame: CGRectMake(0, 0, kDownloadButtonWidth, kDownloadButtonWidth))<br/>
downloadButtonView?.progressDelegate = self
downloadButtonView?.center = self.view.center
self.view.addSubview(downloadButtonView!)
- 使用startDownload()来开启progress动画
self.downloadButtonView?.startDownload()
- 下载文件过程中传入progress值给downloadItem()方法
self.downloadButtonView?.downloadItem(progress)
- 当你下载完成使用协议方法progressCompleted()进行回调
func progressCompleted(){
print("Download Finished")
}