2010-08-10 3 views
0

나는 그 질문을 전에 대답했지만, 여전히 작동하지 않는다.아이폰의 UIImage 배열 메모리 누수가

나는 할당하기 전에 함께 : 나는 울부 짖는 소리처럼 할 adviced왔다,하지만 지금은 두 번째 ANIM가 호출 된 후 immediatly 충돌

imageArray_danceright = [[NSArray alloc] initWithObjects: 

:


//init areas: 

imageArray_stand = [NSArray arrayWithObjects: 
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"FrankieSingtRetime_0001" ofType:@"jpg"]], 
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"FrankieSingtRetime_0002" ofType:@"jpg"]], 
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"FrankiePeaceRetime_0003" ofType:@"jpg"]],nil]; 


imageArray_danceleft = [NSArray arrayWithObjects: 
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"FrankiePeaceRetime_0001" ofType:@"jpg"]], 
.. 40 images 
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"FrankiePeaceRetime_0040" ofType:@"jpg"]],nil]; 

imageArray_danceright = [NSArray arrayWithObjects: 
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"FrankiePeaceRetime_0041" ofType:@"jpg"]], 
.. 40 images 
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"FrankiePeaceRetime_0080" ofType:@"jpg"]],nil]; 


//start: 
[myimageview setAnimationImages:imageArray_stand]; 


myimageview.animationDuration = 0.23; 
myimageview.contentMode = UIViewContentModeBottomLeft; 
myimageview.animationRepeatCount = 0.0; 
myimageview.image = [myimageview.animationImages objectAtIndex:1]; 
[myimageview startAnimating]; 


// ------ in my 'touchesBegan" i have: 

if ([touch view] == overlay_fuesserechts) { 
    [myimageview.animationImages release]; 
    [myimageview setAnimationImages:imageArray_danceright]; 

    myimageview.animationDuration = 2.0; 
    myimageview.contentMode = UIViewContentModeBottomLeft; 
    myimageview.animationRepeatCount = 0; 
    [myimageview startAnimating]; 
} 


- (void)dealloc { 
[imageArray_stand release]; 
imageArray_stand=nil; 
[imageArray_danceright release]; 
imageArray_danceright=nil; 
[imageArray_danceleft release]; 
imageArray_danceleft=nil;  
    super dealloc]; 
} 

그것의 시작 "스탠드"애니메이션이 있습니다.하지만 화재가 나면 즉시로 충돌합니다 :

[myimageview setAnimationImages:imageArray_danceright]; 

나는 잘 모르겠다. 나는 많은 것을 시도했다. 이제는 아이디어가 있기를 바랍니다.

들으 크리스는

+0

log @ console? –

+0

no .. thats prob .. 그냥 멈추다. 나는 [myimageview setAnimationImages : imageArray_danceright] 앞뒤에 NSLog를 만들었습니다. 그 이유는 내가 거기에 충돌 알아 : –

답변

0

이미지 배열이 자동으로 렌더링되기 때문에 TouchesBegan에 도달 할 때까지 이미지 배열이 이미 릴리스되었습니다. 누가 alloc-initWithObjects 대신 arrayWithObjects을 사용하라고 했습니까? 이전 버전이 더 정확했을 것 같습니다. 당신이 그걸 가지고 있었던 문제는 무엇 이었습니까?

+0

잘 작동하기 전에 ... 문제는 메모리를 해제하지 않았기 때문에 4 번째 애플릿 (인스 트루먼 트/할당에서 볼 수 있음) 이후에 100MB가 발생하고 추락했습니다. 나는 당신이 도울 수 있다면 다시 나의 오래된 코드를 게시 할 것이다. –

+0

나는 오래된 코드 – philsquared

+0

을 게시 할 것이고'[myimageview.animationImages release];'나도 틀리게 보인다. 그 시점에서 myimageview.animationImages = nil; – philsquared

0

당신은 확실히 접촉의 시작 부분에 [myimageview.animationImages release];이 시작된 필요가 없습니다. 자동 레이아웃 된 배열 객체를 생성하고이를 해제하는 이미지 뷰에 할당합니다.

+0

확인 .. 내가 [myimageview.animationImages 릴리스] 제거; 하지만 여전히 충돌 할 때 [myimageview setAnimationImages : imageArray_danceright]; 가 해고 되니 ?? –