本文介绍了"不能分配给物业:"任何"是不可改变的"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
tiledViewsStack
包含的UIImageViews。我试图给数组的新中心坐标中的每个的UIImageView。不知道为什么我得到这个错误在for循环......
VAR tiledViewsStack = [AnyObject]() VAR randLocInt = INT()
VAR randLoc = CGPoint() 在tiledViewsStack任何变种
{
randLocInt = INT((arc4random()* 10)%9)// 0,--- 8
randLoc = allCenters [randLocInt] .CGPointValue()
any.center = randLoc
}
解决方案
需要做出 tiledViewsStack
UIImages,不AnyObjects一叠。改变 VAR tiledViewsStack = [AnyObject]()
到 VAR tiledViewsStack = [UIImageView的()
。
tiledViewsStack
contains UIImageViews. I'm trying to give each UIImageView in the array a new center coordinate. Not sure why I'm getting this error for the last line in the for loop...
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
}
解决方案
Needed to make tiledViewsStack
a stack of UIImages, not AnyObjects. Changed var tiledViewsStack = [AnyObject]()
to var tiledViewsStack = [UIImageView]()
.
这篇关于"不能分配给物业:"任何"是不可改变的"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!