我试图重复显示图片,但我发现了超出范围的错误。
这是我的代码:
@IBOutlet weak var im: UIImageView!
var images = ["page003.png","page004.png","page005.png","page006.png"]
var indice = 0
@IBAction func n(sender: AnyObject) {
indice++
if indice == images.count
{
indice == 0
}
im.image = UIImage(named: (images[indice]))
}
答案 0 :(得分:0)
将indice == 0
替换为indice = 0
。