this my code
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.5];
if ([sender tag] == 1) {
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:placeholder cache:YES];
}
else {
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];
}
if (view1OnTop) {
[view1 removeFromSuperview];
[placeholder addSubview:view2];
}
else {
[view2 removeFromSuperview];
[placeholder addSubview:view1];
}
[UIView commitAnimations];
view1OnTop = !view1OnTop;
i want to continuously flip the view, for say some duration 1 min.
it should be continuously flipping.
how can i do it. what i m trying to is, i want a view, which should be continuously flipping for some particular amount of time. how can i achieve this? regards
Apart from the flipping animation, which I presume you have working, you need to initiate a new animation when the current one is finished.
Before [UIView commitAnimations], do this:
add a function
and let that fire the next round.
edit: you do this by putting in the code to fire an animation, so the typical block from
[UIView beginAnimations...]
to[UIView commitAnimations]
. The better solution of course is to put the animation starting code in a separate function, so the outline will look like:to make it go back/forth, add some state variable, or create 2 sets of these functions which call eachother (
startAnimationLoop1
andstartAnimationLoop2
, each one firing the other when done)