iphone - UIImageView animation - using perform selector after delay to display last image in the array -


basically, have uiimageview loop through 8 pngs on 0.5 seconds. @ same time start animation, performselector afterdelay of 0.5 seconds. after uiimageview has finished animating call animationtickdone set last image hidden no.

here's code anyway:

.h @interface viewcontroller : uiviewcontroller{     iboutlet uiview *scannedview;     iboutlet uiimageview *animatedticklast; } @property (nonatomic, retain) iboutlet uiview *scannedview; @property (nonatomic, retain) iboutlet uiimageview *animatedticklast;  .m -(void)found{         [self.view addsubview:scannedview];         [animatedticklast sethidden:yes];         //place animated tick images array         nsmutablearray *animatedtickimages;         animatedtickimages = [[nsmutablearray alloc] init];         nsuinteger nimages = 0;         (nimages=0; nimages<8; nimages++){             nsstring *tickimagename = [nsstring stringwithformat:@"tick_%d.png", (nimages + 1)];             [animatedtickimages addobject:[uiimage imagenamed:tickimagename]];         }         //set animated tick         uiimageview *animatedtick = [[uiimageview alloc] initwithframe:cgrectmake(98, 213, 125, 90)];         [animatedtick setanimationimages:animatedtickimages];         [animatedtick setanimationduration:0.5];         [animatedtick setanimationrepeatcount:1];         [animatedtick startanimating];         nslog(@"animation started");         [self performselector:@selector(animationtickdone) withobject:nil afterdelay:0.5];         [scannedview addsubview:animatedtick];         nslog(@"animation added view");         [animatedtickimages release]; } - (void)animationtickdone{     nslog(@"delay function begins");     [animatedticklast sethidden:no];     sleep(1); //sleep scannedview stays on screen @ least 1.5 seconds (0.5 after animation + 1 sleep); } 

now, problem. animation fine, , works great. when found() first called, animatedticklast become visible after animation. when ever found called again afterwords, animatedtickdone never appears again, it's empty space.

after hours looking around web searching , playing it, cannot understand issue why doesn't appear. thought @ 1 point sleep() getting called before animatedticklast chance set hidden no, after removing sleep() still didn't work.

driving me nuts appreciated.

thanks!

if understand correctly want image after animaton in uiimageview. set image before animation , fine!

[animatedtick setanimationimages:animatedtickimages]; [animatedtick setanimationduration:0.5]; [animatedtick setanimationrepeatcount:1]; [animatedtick setimage:theimageyouliketohave]; [animatedtick startanimating]; 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -