我在 for 循环中使用一些函数来计算对象的新位置:
...some code....
for (int i = self.frame.origin.x; i <= 710; ++i) {
CGPoint newP = CGPointMake(i, 1);
float posY = a * pow((newP.x - w.x),2) - w.y;
CGPoint result = CGPointMake(i, posY);
[NSThread sleepForTimeInterval:1];
self.frame = CGRectMake(result.x, result.y, self.frame.size.width, self.frame.size.height);
NSLog(@"[%f, %f]", result.x, result.y);
}
,但对象仍然存在。
控制台打印:
2012-06-04 23:13:19.183 PERT Estimator[326:707] [304.000000, 169.499985]
2012-06-04 23:13:20.195 PERT Estimator[326:707] [305.000000, 165.172806]
2012-06-04 23:13:21.197 PERT Estimator[326:707] [306.000000, 160.856293]
2012-06-04 23:13:22.200 PERT Estimator[326:707] [307.000000, 156.550461]
2012-06-04 23:13:23.225 PERT Estimator[326:707] [308.000000, 152.255295]
2012-06-04 23:13:24.265 PERT Estimator[326:707] [309.000000, 147.970810]
ETC...
怎么了?