2011-12-07 5 views

답변

3

나는별로 확신하지 못했지만 프레임별로 애니메이션을해야한다고 생각한다. 레이블에 좌표를 설정하면 매개 변수 1과 2의 값 대신 x, y 같은 변수를 넣는다. x와 y의 값이 변하는 애니메이션 타이머에서.

비슷한 코드, 당신은 또한 라벨을 할 수있는 이미지입니다 : -

// Build array of images, cycling through image names 
    for (int i = 0; i < IMAGE_COUNT; i++) 
    [imageArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"Frame_%d.jpg", i]]]; 

    // Animated images - centered on screen 
    animatedImages = [[UIImageView alloc] 
    initWithFrame:CGRectMake(
     (SCREEN_WIDTH/2) - (IMAGE_WIDTH/2), 
     (SCREEN_HEIGHT/2) - (IMAGE_HEIGHT/2) + STATUS_BAR_HEIGHT, 
     IMAGE_WIDTH, IMAGE_HEIGHT)]; 
    animatedImages.animationImages = [NSArray arrayWithArray:imageArray]; 

    // One cycle through all the images takes 1.5 seconds 
    animatedImages.animationDuration = 1.0; 

    // Repeat forever 
    animatedImages.animationRepeatCount = -1; 

    // Add subview and make window visible 
    [window addSubview:animatedImages]; 
    [window makeKeyAndVisible]; 

    // Start it up 
    animatedImages.startAnimating; 

    // Wait 5 seconds, then stop animation 
    [self performSelector:@selector(stopAnimation) withObject:nil afterDelay:1000]; 

을 내가 당신을 도움이되기를 바랍니다 .. :)

관련 문제