【发布时间】:2011-01-15 23:53:28
【问题描述】:
我设置了一个具有两个视图的多视图应用程序。可以使用每个视图中的按钮切换视图(有两个单独的操作)。我正在使用动画 UIViewAnimationTransitionFlipFromRight,当我从第一个视图转到第二个视图时,我要看到的视图出现在翻转动画的后面。我希望它只是白色的。任何帮助表示赞赏。
alt text http://img35.imageshack.us/img35/9982/picture11wu.png
这是切换视图的操作:
- (IBAction)switchViewsOne:(id)sender
{
if (self.uLViewController == nil)
{
ULViewController *uLController =
[[ULViewController alloc]
initWithNibName:@"ULView"
bundle:nil];
self.uLViewController = uLController;
[uLController release];
}
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.25];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
UIViewController *comming = nil;
UIViewController *going = nil;
UIViewAnimationTransition transition;
if (uLViewController.view.superview == nil)
{
comming = uLViewController;
going = mainViewController;
transition = UIViewAnimationTransitionFlipFromLeft;
}
[UIView setAnimationTransition: transition forView:self.view
cache:YES];
[comming viewWillAppear:YES];
[going viewWillDisappear:YES];
[going.view removeFromSuperview];
[self.view insertSubview: comming.view atIndex:10];
[going viewDidDisappear:YES];
[comming viewDidAppear:YES];
[UIView commitAnimations];
}
【问题讨论】: