2013-05-21 4 views
-1

385 개의 png 이미지로 애니메이션을 만들고 싶습니다. 일부 코드를 작성 했으므로 아래에서 볼 수 있습니다. 오류 ... PNG 이미지 시퀀스 애니메이션 오류

내가 "picollage 01"부터 카운트되는 PNG 이미지 (프레임)을 "picollage 385"

큰 목록을 가지고 : 엑스 코드는 "신호 SIGABRT 스레드 1"을주는 시간이 전체 인

내 코드 : [? 왜 새 계정을 만들 않았다]

#define IMAGE_COUNT 385 

NSMutableArray *imageArray = [[NSMutableArray alloc] initWithCapacity:0]; 

    for (int i = 1; i <= IMAGE_COUNT; i++) 

      if (i < 100) { 
       [imageArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"picollage 0%d.png", i]]]; } 
      else { 
       [imageArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"picollage %d.png", i]]];} 

    animatview.animationImages = [imageArray copy]; 
    animatview.animationRepeatCount = 1000; 
    [animatview startAnimating]; 
+0

[[NSMutableArray alloc] initWithCapacity:IMAGE_COUNT]이 있어야 할 문제 [[NSMutableArray alloc] initWithCapacity:0]의 원인이다 (http://stackoverflow.com/questions/ 16633862/gif-animation-from-383-gifs/16634080 # 16634080) – HAS

+0

'[imageArray addObject : [UIImage imageNamed : [[NSString stringWithFormat : @ "picollage 0 % d.png", i] stringByStandardizingPath]]]'? – HAS

+0

http://stackoverflow.com/questions/16676947/png-image-sequence-error ... 정확한 복제물 ... 왜 그렇게합니까? – HAS

답변

0

어쩌면이

+0

Nope;)'initWithCapacity : 0'은 성능 향상을 위해 사용됩니다.) – HAS

+0

@HAS As Apple Document는 https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/ 참조/Reference.html 인스턴스 메소드'- (id) initWithCapacity : (NSUInteger) numItems' '반환 값 numItems 객체를 저장할 수있는 메모리로 초기화 된 배열. 반환 된 객체는 원래 수신기와 다를 수 있습니다. ' – shanegao

+0

당신은 맞지만 토론 부분도 읽으십시오;)'변경 가능한 배열은 필요에 따라 확장됩니다. numItems는 단순히 개체의 초기 용량을 설정합니다. – HAS

관련 문제