NSTimer
을 사용하면 주기적으로 새 (애니메이션 이미지)를 점진적으로 조금씩 움직이는 방법을 호출하여이 작업을 수행 할 수 있습니다.
포물선 호를 따라 개체를 이동하는 일부 샘플 코드 : 당신은 애니메이션을 많이합니다
// Assumptions: We have the variable
// UIView* bird <-- to be moved
// parabolically along the path y = x^2,
// up to translation (that is, slid over so the bottom
// point is not (0,0), but something in the view).
// Suppose bird starts out at (-3, 9) here.
- (void) oneBirdStep {
static const flost ddy = 2;
static float dy = -5; // Start out at 2*x0 + 1.
CGFloat birdY = bird.frame.origin.y + dy;
dy += ddy;
bird.frame = CGRectMake(bird.frame.origin.x + 1, birdY,
bird.frame.size.width, bird.frame.size.height);
}
, 당신은 또한 OpenGL을를 사용하거나 drawRect:
방법을 재정의하는 사용자 정의 UIView
서브 클래스를 작성하는 것이 좋습니다, 이는 위의 코드보다 좀 더 효율적일 수 있습니다.