0
는 내가 객체의 새로운 위치를 계산하는 루프의 일부 기능을 사용어떻게 개체의 위치를 바꿀 수 있습니까?
...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]
등 ...
무슨 잘못?
정확히 그 루프를 작성하여 무엇을하려합니까? – nhahtdh