-1
我一直recieving這個錯誤下標類型爲 '[UIImage的]的值爲':不能與 ')(' 類型的索引
cannot subscript a value of type '[UIImage]' with an index of type '()'
這裏是我的代碼:
let images: [UIImage] = [
UIImage(named: "profilePicture.jpg")!,
UIImage(named: "back3.jpg")!,
UIImage(named: "back1.jpg")!]
var index = 0
let animationDuration: TimeInterval = 0.25
let switchingInterval: TimeInterval = 3
let chnagingImageView = UIImageView()
override func viewDidLoad() {
chnagingImageView.frame = CGRect(x: 0, y: 300, width: view.frame.width, height: 200)
view.addSubview(chnagingImageView)
chnagingImageView.image = images[index += 1]
animateImageView()
}
的錯誤發生在這一行:
chnagingImageView.image = images[index += 1]
任何幫助,將不勝感激。請注意,我看到另一個問題,這只是遊樂場的一個問題,它提供的解決方案是刷新代碼。但是,這不起作用,我仍然收到錯誤。