组件介绍: 能够根据按钮状态显示加载指示器和动画相关视图的按钮。 尝试模仿系统按钮动画,同时提供从多个视图制作按钮的能力:背景视图、图像视图、覆盖视图等。
在较长请求操作时,需要在按钮上显示loading效果,不然可能存在一直点击
开源地址:
https://github.com/APUtils/APButton
在项目Podfile中加入
pod 'APButton'
然后在终端中cd到项目路径执行
pod install
在controller中使用
import APButton
var demobtn:APButton!
demobtn=APButton();
demobtn.startAnimating()//请求时使用 开启loading效果
demobtn.stopAnimating() //请求结束时使用 结束loading效果