YYProgressAnimation 用CABasicAnimation编写 swift版本中间亮色进度条,渐变消失
- iOS 8.0 or later
- ARC
- 创建加载视图
override func viewWillAppear(animated: Bool) {
loadProgress = YYGradualProgressView(frame: CGRect(x:0, y: self.navigationController!.navigationBar.frame.height, width: UIScreen.mainScreen().bounds.size.width, height: 3))
self.navigationController!.navigationBar.addSubview(loadProgress!)
super.viewWillAppear(animated)
}
- 启动加载动画
loadProgress?.startLoadProgressAnimation()
- 加载完成
loadProgress!.stopLoadProgressAnimation()
- 退出时从父视图中移除
loadProgress!.removeFromSuperview()
pod 'YYProgressAnimation', '~> 0.0.2'
==属于学习阶段,会自己完善功能,大神勿喷==