Hi, I had that question before, tried as answered, but still it does not work.
Before I allocated with:
imageArray_danceright = [[NSArray alloc] initWithObjects:
I came adviced to do like bellow, but now it crash immediatly after second anim is called:
//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];
}
Its starts with the "stand" animation.. but when i fire touchesbegan it crashes immediatly at:
[myimageview setAnimationImages:imageArray_danceright];
and i have no idea. I tried so many things. Now I hope you have an idea.
thx chris