ui控件之UIImageView(imageView的动画效果)
来源:互联网 发布:linux查看文件命令 编辑:程序博客网 时间:2024/06/05 15:58
// Created by Catherine on 2017/8/28.
// Copyright © 2017年 Catherine. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
overridefunc viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//创建一个imageView
let imageView:UIImageView =UIImageView(frame: CGRect(x: 100, y:100, width: 100, height:100))
//给imageView设置图片
imageView.image =UIImage(named: "pig1.png")
//设置imageView的背景颜色
imageView.backgroundColor =UIColor.gray
//设置imageView的高亮图片
imageView.highlightedImage =UIImage(named: "pig2.png")
//设置imageView为高亮状态(才能显示上图)
//imageView.isHighlighted = true
//设置imageView的动画效果(播放一组图片)
//创建一个数组
var array:Array<UIImage?> =Array()
for iin 1 ..<5 {
let image:UIImage? =UIImage(named: String(format:"pig%d.png", i))
array.append(image!)
}
//设置imageView的动画数组
imageView.animationImages = arrayas? [UIImage]
//设置播放的次数 0是循环播放
imageView.animationRepeatCount =0
//设置播放一轮的时间
imageView.animationDuration =1.5
//开始播放动画
imageView.startAnimating()
self.view.addSubview(imageView)
}
overridefunc didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
- ui控件之UIImageView(imageView的动画效果)
- UIImageView的动画效果
- UI控件笔记(二):UI之UILabel和UIImageView
- UI控件之显示图像控件ImageView(上)
- UI控件之显示图像控件ImageView(下)
- Objective-UIImageView的创建和使用(带动画效果)
- 05-常用UI控件之 UIImageView
- iOS UI基础控件之UIImageView
- 【andorid 之UI效果】晃动的动画(shakeAnimation)
- UISegmentedControl + UISlider +UIImageView的动画效果
- UI基础----基本控件的使用之ImageView
- UIImageView实现动画效果
- 基本控件UIImageView的帧动画
- UI控件 - UIImageView
- IOS UI控件 - UIImageView
- UI控件--UIImageView
- Android02--Android之UI控件ImageView+ImageButton
- Android UI - 带白边的自定义ImageView效果
- MTCNN中用celebA样本生成landmark训练样本python代码解读
- docker 内编译tensorflow serving时报错:No space left on device
- Hibernate的三种状态。
- python 网络编程(udp)
- mybaits批量新增修改
- ui控件之UIImageView(imageView的动画效果)
- lintcode翻转链表
- Java 集合
- 总结:ajax多文件上传,laravel后台篇
- TCP/IP协议数据在每层中的长度
- 四种计算UIWebView高度的方法,总有一种适合你的需求
- Oracle之SQL子查询
- Node中Buffer对字符串的处理
- 常见C++面试题及基本知识点总结