Iphone 如何在“UIScrollview”中提供页面翻转效果?

Iphone 如何在“UIScrollview”中提供页面翻转效果?,iphone,objective-c,ipad,Iphone,Objective C,Ipad,我正在开发一个应用程序,其中我正在使用UIScrollview,因为我需要使用页面翻转效果 如何在UIScrollview中实现页面翻转效果 注意:在UIScrollview中,当我们更改页面时,向前和向后滚动页面。当我们滚动页面时,是否可以提供页面滚动效果?向前翻转- CATransition *animation = [CATransition animation]; [animation setDelegate:self]; [animation setDuration:1.0f]; an

我正在开发一个应用程序,其中我正在使用
UIScrollview
,因为我需要使用页面翻转效果

如何在
UIScrollview
中实现页面翻转效果


注意:在UIScrollview中,当我们更改页面时,向前和向后滚动页面。当我们滚动页面时,是否可以提供页面滚动效果?

向前翻转-

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"]; 
向后翻转-

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委托时,您可以使用此代码。

请更好地解释您的问题。页面翻转效果仅在使用PageViewController时从iOS 5以本机方式提供。在UIScrollView中,当我们更改页面时,向前和向后滚动页面。当我们滚动页面时,是否可以提供页面滚动效果。使用-(void)scrollViewDidScroll:(UIScrollView*)scrollView;方法并以thsi方法执行动画。确保已启用分页。