tiledViewsStack
包含 UIImageViews。我试图给数组中的每个 UIImageView 一个新的中心坐标。不知道为什么我在 for 循环的最后一行收到此错误...
var tiledViewsStack = [AnyObject]()
var randLocInt = Int()
var randLoc = CGPoint()
for var any in tiledViewsStack
{
randLocInt = Int((arc4random()*10) % 9) // 0, --- 8
randLoc = allCenters[randLocInt].CGPointValue()
any.center = randLoc
}
最佳答案
需要使 tiledViewsStack
成为一堆 UIImage,而不是 AnyObject。将 var tiledViewsStack = [AnyObject]()
更改为 var tiledViewsStack = [UIImageView]()
。
关于ios - "Cannot assign to property: "任何 "is immutable"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36525393/