views:

23

answers:

1

Hello guys!

First here's my code:

[_helperView addSubview:_navigationController.view];
[_helperView addSubview:itemView];

[UIView beginAnimations:@"pageFlipAnimation" context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:_helperView cache:NO];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(pageFlipAnimationDidStop)];
[itemView removeFromSuperview];
[UIView commitAnimations];

My problem with this that nothing is animated. If I add the _navigationController.view and itemView before (I mean not in this method) everything is ok, but when I add before the animation it does nothing. I also tried to call again the animation in the animation didStopSelector and also works there. Can you help me please why it doesn't want to work in this case? Any suggestions how to resolve it?

+1  A: 

You should probably give the UI the chance to effectuate the addition of itemView. To do this, add a line after addSubview:itemView:

[self performSelector(removeAnim:) withObject:itemView afterDelay:0.01];

and move the animation block to a function

-(void)removeAnim:(UIVieW*)itemView

This should fix the problem.

mvds