objective c - I want to flash an UIImageview on the iPad, how do I do that? -
i want let uiimageview
flash several times.
currently don't know how that.
actual code:
-(void)arrowsanimate{ [uiview animatewithduration:1.0 animations:^{ arrow1.alpha = 1.0; arrow2.alpha = 1.0; arrow3.alpha = 1.0; nslog(@"alpha 1"); } completion:^(bool finished){ [self arrowsanimate2]; }]; } -(void)arrowsanimate2{ [uiview animatewithduration:1.0 animations:^{ arrow1.alpha = 0.0; arrow2.alpha = 0.0; arrow3.alpha = 0.0; nslog(@"alpha 0"); } completion:^(bool finished){;}]; }
later on call this:
for (int = 0;i < 10; i++){ [self arrowsanimate]; }
this gives me 10x alpha 1, , 10x alpha 0. in middle see 1 animation. suggestions?
thanks.
there simpler way achieve flashing animation using 1 animation block:
aview.alpha = 1.0f; [uiview animatewithduration:0.5f delay:0.0f options:uiviewanimationoptionautoreverse animations:^ { [uiview setanimationrepeatcount:10.0f/2.0f]; aview.alpha = 0.0f; } completion:^(bool finished) { [aview removefromsuperview]; }];
the trick use [uiview setanimationrepeatcount:ntimes/2]; *_inside_* animation block
. no need functions or loops.
Comments
Post a Comment