iOS --- 使用UIImageView来实现倒计时动画
2015-10-28 07:33
513 查看
UIImageView动画
UIImageView自身即提供了多个图片切换的动画效果,可用于实现倒计时等动画。// these allow a set of images to be animated. the array may contain multiple copies of the same public var animationImages: [UIImage]? // The array must contain UIImages. Setting hides the single image. default is nil @available(iOS 3.0, *) public var highlightedAnimationImages: [UIImage]? // The array must contain UIImages. Setting hides the single image. default is nil public var animationDuration: NSTimeInterval // for one cycle of images. default is number of images * 1/30th of a second (i.e. 30 fps) public var animationRepeatCount: Int // 0 means infinite (default is 0) // When tintColor is non-nil, any template images set on the image view will be colorized with that color. // The tintColor is inherited through the superview hierarchy. See UIView for more information. @available(iOS 7.0, *) public var tintColor: UIColor! public func startAnimating() public func stopAnimating() public func isAnimating() -> Bool
倒计时动画的样例如下:
func imageViewAnimation() { var images: Array = Array<UIImage>() for var i in 1...10 { images.append(UIImage(named: "\(i).jpg")!) } images = images.reverse() imageView.animationImages = images imageView.animationRepeatCount = 0 imageView.animationDuration = 10 imageView.startAnimating() }
Demo
Demo地址: DemoAnimation相关文章推荐
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 不可修补的 iOS 漏洞可能导致 iPhone 4s 到 iPhone X 永久越狱
- iOS 12.4 系统遭黑客破解,漏洞危及数百万用户
- 每日安全资讯:NSO,一家专业入侵 iPhone 的神秘公司
- [转][源代码]Comex公布JailbreakMe 3.0源代码
- Gifski:一个跨平台的高质量 GIF 编码器
- 模仿动画的放大缩小容器
- Android中ViewFlipper的使用及设置动画效果实例详解
- jQuery实现美观的多级动画效果菜单代码
- php判断GIF图片是否为动画的方法
- jQuery实现动画效果circle实例
- 浅析JavaScript动画
- js排序动画模拟-插入排序
- javascript+HTML5的Canvas实现Lab单车动画效果
- 基于javascript实现漂亮的页面过渡动画效果附源码下载
- js实现按钮颜色渐变动画效果
- jQuery实现连续动画效果实例分析
- jQuery实现带有洗牌效果的动画分页实例