I have got a problem. I have made view including a scrollview. In the scrollview I am adding lottery balls with labels.
I have setup the animation between views and when this view with the balls animated, the balls are at the same position (left upper corner of the scrollview), until the animation is fully finished. Than the balls are jumping to their proper location. There is no problem with the label开发者_运维百科 which are showing the lottery numbers on the balls.
I have tried to figure out why is that happens, but I cannot find any answer for this weird effect.
If anybody can help it is very much appreciated.
I am simply using the standard core animations to switch the views.
I just have found out that if I change the cache parameter to NO in the following line, than the balls are also animated during the transition.
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:NO];
Thanks
Endre
Actually, I have found the solution for this weird behaviour.
[self.view insertSubview:ToView.view atIndex:0];
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:2];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut ];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:NO];
[ToView viewWillAppear:YES];
[FromView viewWillDisappear:YES];
[FromView.view removeFromSuperview];
[FromView viewDidDisappear:YES];
[ToView viewDidAppear:YES];
[UIView commitAnimations];
Originally the line "[self.view insertSubview:ToView.view atIndex:0];" was between the BeginAnimation - commitAnimations block.
Once I have created the view outside of this, it started to work fine.
精彩评论