xcode - UIImage View animation works one time... why? -


i'm developing game in xcode 4.3.2

ingame need call function add 2 images on screen animation, first image enter left, second right , after 2 sec gone off:

-(void) pandaanimation2 { [pandablock3 removefromsuperview]; [awesomeview removefromsuperview];  //pandablock3 uiimageview //awesomeview uiimageview pandablock3.frame = cgrectmake(400, 101, 111, 208); awesomeview.frame = cgrectmake(-400, 9, 230, 68);  [self addsubview:pandablock3]; [self addsubview:awesomeview];   [uiimageview beginanimations:@"movein" context:null]; [uiimageview setanimationbeginsfromcurrentstate:yes]; [uiimageview setanimationdelegate:self]; [uiimageview setanimationcurve:uiviewanimationcurveeasein]; [uiimageview setanimationduration:2.0];  pandablock3.frame = cgrectmake(208, 101, 111, 208); awesomeview.frame = cgrectmake(11, 9, 230, 68);  [uiimageview commitanimations];  [uiimageview beginanimations:@"moveout" context:null]; [uiimageview setanimationdelay:2.0]; [uiimageview setanimationbeginsfromcurrentstate:yes]; [uiimageview setanimationdelegate:self]; [uiimageview setanimationduration:1.0]; [uiimageview setanimationcurve:uiviewanimationcurveeaseout];  pandablock3.frame = cgrectmake(400, 101, 111, 208); awesomeview.frame = cgrectmake(-400, 9, 230, 68); [uiimageview commitanimations]; 

}

it works good, 1 time! why?

please help!

it hard witout looking calling code, guess pandablock3 , awesomeview released after first call , hence nil in second call.


Comments