// 实例化let activityvIEw = UIActivityIndicatorVIEw(frame: CGRectMake(10.0,10.0,50.0,50.0))self.vIEw.addSubvIEw(activityvIEw) activityvIEw.backgroundcolor = UIcolor.yellowcolor() activityvIEw.activityIndicatorVIEwStyle = UIActivityIndicatorVIEwStyle.WhiteLargeactivityvIEw.color = UIcolor.redcolor() // 停止转圈圈时,隐藏activityvIEw.hIDesWhenStopped = trueactivityvIEw.startAnimating() activityvIEw.tag = 1000
let swithch = UISwitch(frame: CGRectMake(100.0,0.0,0.0))self.vIEw.addSubvIEw(swithch)swithch.on = falseswithch.addTarget(self,action: Selector("switchValueChange:"),forControlEvents: UIControlEvents.ValueChanged)
// MARK: - switchValueChangefunc switchValueChange(sender:UISwitch){ let activityvIEw = self.vIEw.vIEwWithTag(1000) as! UIActivityIndicatorVIEw let openStatus = sender.on if openStatus { if !activityvIEw.isAnimating() { activityvIEw.startAnimating() } } else { activityvIEw.stopAnimating() }}
总结
以上是内存溢出为你收集整理的swift中UIActivityIndicatorView的使用全部内容,希望文章能够帮你解决swift中UIActivityIndicatorView的使用所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)