UIImageView swift

时间:2022-06-23 15:24:38

//

// ViewController.swift

// UILabelTest

//

// Created by mac on 15/6/23.

// Copyright (c) 2015年 fangyuhao. All rights reserved.

//

import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad() var imageView = UIImageView(image: UIImage(named: "icon"))
imageView.frame = CGRectMake(10, 10, 100, 100) imageView.animationImages = [UIImage(named: "icon"),UIImage(named: "icon2")]//为什么不可以
imageView.animationDuration = 0.5 self.view.addSubview(imageView)
// Do any additional setup after loading the view, typically from a nib.
} override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

}