如何在“UIScrollview”中提供Page翻转效果? [英] How can I give Page flip effect in `UIScrollview`?
本文介绍了如何在“UIScrollview”中提供Page翻转效果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 UIScrollview
的应用程序,因为我需要使用页面翻转效果。
I am working on an application in which I am using UIScrollview
, in that I need to use page flip effect.
如何在 UIScrollview
中提供页面翻转效果?
How can I give Page flip effect in UIScrollview
?
注意 :在UIScrollview中,当我们更改Page时,滚动页面向前和向前滚动落后。我们滚动页面的时候可以给页面滚动效果吗?
Note: In UIScrollview when we change Page at that time Scrolling the Page forward & backward. Can it be possible to give Page scroll effect at the time when we scroll page?
推荐答案
向前翻转 -
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:1.0f];
animation.startProgress = 0;
animation.endProgress = 1;
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
animation.type = @"pageCurl";
animation.subtype=@"fromRight";
animation.fillMode = kCAFillModeForwards;
[animation setRemovedOnCompletion:NO];
[animation setFillMode: @"extended"];
[animation setRemovedOnCompletion: NO];
[lyr addAnimation:animation forKey:@"WebPageCurl"];
向后翻转 -
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:1.5f];
animation.startProgress = 0;
animation.endProgress = 1;
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
animation.type = @"pageUnCurl";
animation.subtype=@"fromRight";
animation.fillMode = kCAFillModeBackwards;
[animation setRemovedOnCompletion:NO];
[animation setFillMode: @"extended"];
[animation setRemovedOnCompletion: NO];
[lyr addAnimation:animation forKey:@"WebPageCurl"];
您可以在UIScrollView委托时使用此代码。
you can use this code when UIScrollView delegates.
这篇关于如何在“UIScrollview”中提供Page翻转效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文