从图像数组中动画UIImageView - Swift

时间:2015-07-15 02:13:38

标签: arrays variables animation uiimageview sequence

我尝试从 PNG-Sequence 制作 ImageView 动画。但是,在" imageList = UIImage(named: imageName)"我收到一个错误,指出以下内容:缺少参数' inBundle'在电话中。

class ViewController: UIViewController {

@IBOutlet weak var myImageView: UIImageView!
var imageList = [UIImage]()

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

    startAnimation()


    for i in 0...120
    {

        let imageName = "\(i)"
        imageList = UIImage(named: imageName)

    } 


}


@IBAction func generate(sender: AnyObject) {

     tabBarController?.selectedIndex = 1

}

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

func startAnimation() -> Void
{
    myImageView.animationImages = imageList
    myImageView.startAnimating()
}
}

谷歌搜索了几个小时,但似乎无法找到任何有用的东西。它与本教程中的代码相同:https://www.youtube.com/watch?v=PSny6un3VUw

0 个答案:

没有答案