我在Xcode中使用以下代码在iPhone应用程序中的2个视图之间水平翻转
-(IBAction)switchView:(id)sender{
Algorithm2ViewController *Algorithm2ViewControllergo = [[Algorithm2ViewController alloc]
initWithNibName:@"Algorithm2ViewController" bundle:nil];
[UIView beginAnimations:@"flipview" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
forView:self.view cache:NO];
[self.view addSubview:Algorithm2ViewControllergo.view];
[UIView commitAnimations];
}
在第一次翻转后,我在翻转完成之前得到了背景中即将到来的视图的图像我该如何摆脱它?
答案 0 :(得分:0)
我在第二个视图中想到了这一点,添加以下代码
-(IBAction)switchView2:(id)sender{
SecondViewController *SecondViewControllergo = [[SecondViewController alloc]
initWithNibName:@"SecondView"
bundle:nil];
[UIView beginAnimations:@"flipview" context:nil];
[UIView setAnimationDuration:2];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
forView:self.view.superview cache:NO];
[self.view addSubview:SecondViewControllergo.view];
[self.view removeFromSuperview];
[UIView commitAnimations];
[SecondViewControllergo release];
}
从超视图行中删除将删除背景图像