我得到了一个数组“coordList”,其中的数组保存了 xy 坐标。
我想沿着这些坐标移动视图。
如果您有更好的方法来做到这一点,请告诉我该怎么做。
我这样做的方式有一个大问题。它直接跳到最后一个动画,我知道为什么但不知道如何修复它。
我的代码:
count = 1;
for(NSArray *array in coordList) {
[UIView animteWithDuration:1 animations:^(void){
CGRect r = [[self.subviews lastObject] frame];
r.origin.x = 103*[coordList[count][0]integerValue];
r.origin.y = 103*[coordList[count][1]integerValue];
[[self.subviews lastObject] setFrame:r];
count++;
[UIView commitAnimations];
}
}
对不起,我的英语不好 :)