swift-UIImageView帧动画

 //
//  ViewController.swift
//  Swift-UIImageView制作帧动画
//
//  Created by 品德信息 on 2017/3/23.
//  Copyright © 2017年 品德信息. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()

//初始化一个数组来存放图片
    var images = [UIImage]();
    for i in 1 ... 19{
        images.append(UIImage(named: "FuncIcon\(i)")!)
        
    }
    let imageView  = UIImageView(frame:CGRect(x:0,y:60,width:335,height:253))
    imageView.animationImages = images
    imageView.animationDuration = 5
    imageView.animationRepeatCount = 0
    imageView.startAnimating()
    
    self.view.addSubview(imageView)
    
    
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
    }
}

你可能感兴趣的:(swift-UIImageView帧动画)