Swift - 通过叠加UILabel来实现混合的进度条
Swift - 通过叠加UILabel来实现混合的进度条

效果

源码
https://github.com/YouXianMing/Swift-Animations
//
// MixedColorProgressViewController.swift
// Swift-Animations
//
// Created by YouXianMing on 16/8/21.
// Copyright © 2016年 YouXianMing. All rights reserved.
// import UIKit class MixedColorProgressViewController: NormalTitleViewController { private var upView : UIView!
private var upLabel : UILabel!
private var downView : UIView!
private var downLabel : UILabel!
private var timer : GCDTimer! = GCDTimer(inQueue: GCDQueue.mainQueue) override func setup() { super.setup() downView = UIView(frame: CGRectMake(, , , ))
downView.center = (contentView?.middlePoint)!
downView.layer.cornerRadius =
downView.backgroundColor = UIColor.whiteColor()
downView.layer.masksToBounds = true
contentView?.addSubview(downView) downLabel = UILabel(frame: downView.bounds)
downLabel.font = UIFont.HelveticaNeueThin(12.0)
downLabel.text = "YouXianMing - iOS Programmer"
downLabel.textColor = UIColor.redColor()
downLabel.textAlignment = .Center
downView.layer.borderWidth = 0.5
downView.layer.borderColor = UIColor.redColor().CGColor
downView.addSubview(downLabel) upView = UIView(frame: CGRectMake(, , , ))
upView.center = (contentView?.middlePoint)!
upView.layer.cornerRadius =
upView.backgroundColor = UIColor.redColor()
upView.layer.masksToBounds = true
contentView?.addSubview(upView) upLabel = UILabel(frame: upView.bounds)
upLabel.font = UIFont.HelveticaNeueThin(12.0)
upLabel.text = "YouXianMing - iOS Programmer"
upLabel.textColor = UIColor.whiteColor()
upLabel.textAlignment = .Center
upView.addSubview(upLabel) weak var wself = self
timer.event({ UIView.animateWithDuration(0.5, delay: , usingSpringWithDamping: , initialSpringVelocity: , options: .CurveEaseInOut, animations: { wself?.upView.width = CGFloat(arc4random() % ) }, completion: nil) }, timeIntervalWithSeconds: , delayWithSeconds: )
timer.start()
}
}
Swift - 通过叠加UILabel来实现混合的进度条的更多相关文章
- [Swift通天遁地]一、超级工具-(2)制作美观大方的环形进度条
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- Swift实战-豆瓣电台(八)播放进度与时间
视频观看地址:http://www.tudou.com/programs/view/4mEtz8S72k0/?resourceId=399000367_06_02_99 这节主要内容是NSTimer, ...
- Swift - 环形进度条(UIActivityIndicatorView)的用法
Swift中,除了条形进度条外,还有环形进度条,效果图如下: 1,环形进度条的基本属性 (1)Style: Large White:比较大的白色环形进度条 White:白色环形进度条 Gray:灰色环 ...
- 混合开发(一)——WebView开发高级技巧之加载网页以及JavaScript,加载进度条
混合开发(一)--WebView开发高级技巧之加载网页以及JavaScript,加载进度条 现在关于混合开发也越来越多了,很多人喜欢跟随,比如HB,比如RN,其实这东西很早就有这么一个概念了,而且说实 ...
- ios swift 实现饼状图进度条,swift环形进度条
ios swift 实现饼状图进度条 // // ProgressControl.swift // L02MyProgressControl // // Created by plter on 7/2 ...
- iOS WKWebView 加载进度条、导航栏返回&关闭 (Swift 4)
导航: 1.加载进度条 2.导航栏增加返回.关闭按钮 加载进度条 效果图 代码如下: self.progressView.trackTintColor = UIColor.white self.pro ...
- iOS -Swift 3.0 -UILabel属性大全
昨天研究了一下苹果近两年新出的Swift语言,感觉学起来并不是很吃力,毕竟自己有过Objective-C的语言功底,所以各方面的属性控件还是一眼就可以认出的,只是Swift的写法与Objective- ...
- Swift - 文本标签(UILabel)的用法
1,标签的创建 1 2 3 4 5 6 7 8 9 10 import UIKit class ViewController: UIViewController { override func ...
- swift 实践- 03 -- UILabel
class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // 标签 let ...
随机推荐
- laravel 打印sql语句
public function getCurrencyOrder($user_id=70,$pid=252,$register=['register:first']) { DB::connection ...
- (转载)How browsers work--Behind the scenes of modern web browsers (前端必读)
浏览器可以被认为是使用最广泛的软件,本文将介绍浏览器的工 作原理,我们将看到,从你在地址栏输入google.com到你看到google主页过程中都发生了什么. 将讨论的浏览器 今天,有五种主流浏览器— ...
- 了解一下LDC
转自: Linguistic Data Consortium (LDC) 因为Kaldi里面各种语料涉及到LDC,搜罗一下,好像并没有相应的教程和网站用法.... 搞 NLP 的人经常会听到一个神秘的 ...
- 程序设计实习MOOC / 程序设计与算法(三)第二周测验
6. 学生信息处理程序 总时间限制: 1000ms 内存限制: 1024kB 描述 实现一个学生信息处理程序,计算一个学生的四年平均成绩. 要求实现一个代表学生的类,并且类中所有成员变量都是[私有的] ...
- EntityFramework系列:SQLite的CodeFrist和RowVersion
没什么好说的,能支持DropCreateDatabaseIfModelChanges和RowVersion的Sqlite谁都想要.EntityFramework7正在添加对Sqlite的支持,虽然EF ...
- 少走弯路,一个老程序猿谈PHP职业发展规划
PHP是一个使用者非常多的开发语言,但在每个领域里的开发侧重点有所不同互联网方面,在稳定的基础上,更注重性能.高并发,高负载的处理. PHP职业发展规划一般有三条路线,一条技能专精发展路线.另两条,是 ...
- 一个简单的python练习题
最近几天看了python的基础知识,也写了两篇博客:http://futuretechx.com/python2/和 http://futuretechx.com/python-basicknowl/ ...
- kotlin 安装 使用
插件下载 下载 kotlin 扩展 . 可以 简写 findviewbyid 这些. 比如 id 是 textview 直接 这样赋值 textview.setText("测试文字" ...
- 2013-2014 ACM-ICPC, NEERC, Southern Subregional Contest Problem D. Grumpy Cat 交互题
Problem D. Grumpy Cat 题目连接: http://www.codeforces.com/gym/100253 Description This problem is a littl ...
- 39、ABTestingGateway
2015 年度新增开源软件排名 TOP 100 - 开源中国社区 http://www.oschina.net/news/69808/2015-annual-ranking-top-100-new ...