简体   繁体   English

页面卷曲过渡像书的两面(从右侧到左侧的过渡,反之亦然)

[英]page curl transition like a book two sides (transition from right side to left side & vice versa)

Hy, i want to make a pagecurltransition like in a book, when i press one button is curlup and i want to see while the transition is beeing made the next page. 嗨,我想像书中一样进行pagecurltransition,当我按下一个按钮时,我要卷曲,我想看看在转换时蜂拥而至的情况下一页。 And for curldown i want the transition view to be with the next page. 对于curldown,我希望过渡视图位于下一页。 Like when i move pages in a book. 就像我在书中移动页面时一样。 The transition works fine but the problem is that i want my instruction to be executed while the transition is beeing done. 过渡工作正常,但问题是我希望在完成过渡的同时执行我的指令。 The problem is that mywebview loads the text after the transition is done. 问题是mywebview在转换完成后会加载文本。

UIViewAnimationOptions animation;
if (_webview) {
    animation = UIViewAnimationOptionTransitionCurlDown;
} else {
    animation = UIViewAnimationOptionTransitionCurlUp;
}
CATransition *aanimation = [CATransition animation];
[aanimation setDelegate:self];
[aanimation setDuration:1.0f];
aanimation.startProgress = 0.5;
aanimation.endProgress   = 1;

[aanimation setSubtype:kCATransitionMoveIn];

[aanimation setRemovedOnCompletion:NO];
[aanimation setFillMode: @"extended"];
[aanimation setRemovedOnCompletion: NO];
[[_webview layer] addAnimation:aanimation forKey:@"WebPageCurl"];

UIWebView is tricky because it doesn't render immediately, so it isn't ready when you take the snapshot for your page animation. UIWebView棘手,因为它不会立即呈现,因此在为页面动画拍摄快照时还没有准备好。 The best you can hope for is like Flipboard, where you flip the page and it fades in. Otherwise you have 2 choices. 您可以期望的最好的功能是Flipboard,您可以在其中翻转页面并淡入。否则,您有2个选择。

1) Keep a cache of your next and previous page around always (this is what I did when I was trying to get around this problem) 1)始终保持您下一页和上一页的缓存(这是我尝试解决此问题时所做的事情)

2) Wait for the web views to load before playing the animation (this will cause a noticeable delay and is not advisable) 2)在播放动画之前等待网络视图加载(这导致明显的延迟,因此不建议)

只需添加UIViewAnimationOptions.AllowAnimatedContent作为额外的参数,即可在其中提供curlup / curlDown动画。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM