动画的麻烦

发布于 2024-11-09 11:34:01 字数 1449 浏览 0 评论 0 原文

我有一个小问题,我有一个带有 webview 和一些按钮的视图控制器,我想向 webview 应用卷曲动画,并在同一控制器上查看 instad webview 视图。

像这样

在此处输入图像描述

而不是这个

在第一种情况下,我使用 webview.hidden = YES 但当我尝试返回时,如果我将 webview.hidden = NO 放在返回方法上,则视图(显然)是隐藏的我得到这个

在此处输入图像描述

有什么解决方案吗?

这是我的代码:

- (IBAction)toggleView:(id)sender {


    CATransition *animation = [CATransition animation];
    [animation setDelegate:self.view];
    [animation setDuration:0.7];
    [animation setTimingFunction:UIViewAnimationCurveEaseInOut];

    animation.type = @"pageCurl";
    animation.fillMode = kCAFillModeForwards;
    animation.endProgress = 0.7;

    [animation setRemovedOnCompletion:NO];
    [[self.vistaWeb layer] addAnimation:animation forKey:@"pageCurlAnimation"];

}

- (IBAction) torna {

    CATransition *animation = [CATransition animation];
    [animation setDelegate:self.view];
    [animation setDuration:0.7];
    [animation setTimingFunction:UIViewAnimationCurveEaseInOut];

    animation.type = @"pageCurl";
    animation.fillMode = kCAFillModeBackwards;
    animation.startProgress = 0.7;
    animation.endProgress = 0;

    [animation setRemovedOnCompletion:NO];  
    [[self.vistaWeb layer] addAnimation:animation forKey:@"pageCurlAnimation"];
}

I have a little problem, I have a viewcontroller with a webview and some button, I want to apply to webview a curl animation and see instad webview the view if the same controller.

like this

enter image description here

instead this

enter image description here

in the first case I use webview.hidden = YES but when I try to came back the view is (obviusly) hidde, if I put webview.hidden = NO on the method for come back I get this

enter image description here

any solution?

this is my code:

- (IBAction)toggleView:(id)sender {


    CATransition *animation = [CATransition animation];
    [animation setDelegate:self.view];
    [animation setDuration:0.7];
    [animation setTimingFunction:UIViewAnimationCurveEaseInOut];

    animation.type = @"pageCurl";
    animation.fillMode = kCAFillModeForwards;
    animation.endProgress = 0.7;

    [animation setRemovedOnCompletion:NO];
    [[self.vistaWeb layer] addAnimation:animation forKey:@"pageCurlAnimation"];

}

- (IBAction) torna {

    CATransition *animation = [CATransition animation];
    [animation setDelegate:self.view];
    [animation setDuration:0.7];
    [animation setTimingFunction:UIViewAnimationCurveEaseInOut];

    animation.type = @"pageCurl";
    animation.fillMode = kCAFillModeBackwards;
    animation.startProgress = 0.7;
    animation.endProgress = 0;

    [animation setRemovedOnCompletion:NO];  
    [[self.vistaWeb layer] addAnimation:animation forKey:@"pageCurlAnimation"];
}

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文