模态视图控制器

发布于 2024-12-07 19:01:08 字数 802 浏览 0 评论 0原文

我在 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];
}

,第一次翻转后我在翻转完成之前在后台获得了即将出现的视图的图像,我该如何摆脱它?

I am using the following code in Xcode to horizontally flip between 2 views in an iPhone app

 -(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];
}

after the first flip I get an image of the coming view in the background before the completion of the flip how do I get rid of it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

御守 2024-12-14 19:01:08

我已经在第二个视图中找到了这一点,添加以下代码

-(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];


}

从超级视图行中删除将删除背景图像

I have figured this out in the second view add the following code

-(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];


}

The remove from superview line will remove the background image

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文