2010-02-26 5 views
0

iPhone SDK에서 애니메이션 UIImageView를 만들고 카메라 오버레이로 사용하려고합니다. 그러나 아무 것도 나타나지 않습니다. 다음 코드를 사용하려고 할 때 내가 오버레이로 정적 이미지를 표시하기 위해 동일한 설정을 사용하여,하지만 봤는데, 더 오버레이가 나타납니다 : iPhone 카메라 오버레이로 애니메이션 UIImageView 사용

imageView.animationImages = [NSArray arrayWithObjects: 
            [UIImage imageNamed:@"cameraScreenOverlay1.png"], 
            [UIImage imageNamed:@"cameraScreenOverlay2.png"], 
            [UIImage imageNamed:@"cameraScreenOverlay3.png"], 
            [UIImage imageNamed:@"cameraScreenOverlay4.png"], 
            [UIImage imageNamed:@"cameraScreenOverlay4.png"], 
            [UIImage imageNamed:@"cameraScreenOverlay4.png"], 
            [UIImage imageNamed:@"cameraScreenOverlay3.png"], 
            [UIImage imageNamed:@"cameraScreenOverlay2.png"], 
            [UIImage imageNamed:@"cameraScreenOverlay1.png"], 
            nil]; 
     imageView.animationDuration = 1.0; 
     imageView.animationRepeatCount = 0; 
     [imageView startAnimating]; 

나는 위의 코드는 이미지 뷰가 사용되지 않을 때 작동합니다 알고 오버레이. 이견있는 사람? 이것은 현재 SDK의 제한 사항입니까?

답변

1

나는 똑같은 일을하려하고있다. 오버레이 이미지 일 때 작동하지만 일단 이미지 배열로 애니메이션을 만들려고하면 아무것도 표시되지 않습니다.

imageWithContentsOfFile을 사용하여 png를 모두 잘못로드했습니다. 그것은 단지 이미지 파일을로드하지 않을 것이다. 실제 경로가 필요합니다. 다음과 같이 시도하십시오.

NSArray *animationImages = [NSArray arrayWithObjects: 
           [UIImage imageWithContentsOfFile:[[ NSBundle mainBundle] pathForResource:@"back1" ofType:@"png"]], 
           [UIImage imageWithContentsOfFile:[[ NSBundle mainBundle] pathForResource:@"back2" ofType:@"png"]], 
           [UIImage imageWithContentsOfFile:[[ NSBundle mainBundle] pathForResource:@"back3" ofType:@"png"]], 
           [UIImage imageWithContentsOfFile:[[ NSBundle mainBundle] pathForResource:@"back4" ofType:@"png"]], 
           [UIImage imageWithContentsOfFile:[[ NSBundle mainBundle] pathForResource:@"back5" ofType:@"png"]], 
           [UIImage imageWithContentsOfFile:[[ NSBundle mainBundle] pathForResource:@"back6" ofType:@"png"]], 
           [UIImage imageWithContentsOfFile:[[ NSBundle mainBundle] pathForResource:@"back7" ofType:@"png"]],nil]; 


    imageview = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,480)]; 
    imageview.animationImages = [animationImages retain] ; 
    imageview.animationRepeatCount = 0; 
    imageview.animationDuration= 1; 

    [overlay.view addSubview:imageview]; 

    [moviePlayerWindow addSubview:overlay.view]; 
관련 문제