我尝试从 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