UIActivityIndivatorView 的使用
代码:
// 实例化
let activityview = UIActivityIndicatorView(frame: CGRectMake(10.0, 10.0, 50.0, 50.0))
activityview.center = CGPoint(x:20, y:170)
activityview.backgroundColor = .red
activityview.color = .red
activityview.style = .red
activityview.startAnimating()
// 停止转圈时隐藏
activityview.hidesWhenStopped = true
activityview.tag = 1000
给UIActivityIndivatorView 上 添加一个手势
代码如下:
let tapSingle=UITapGestureRecognizer(target:self,action:#selector(stop))
tapSingle.numberOfTapsRequired = 1
tapSingle.numberOfTouchesRequired=1
activityIndicator.addGestureRecognizer(tapSingle)
网友评论