我正在开发一个使用 UIScrollview
的应用程序,因为我需要使用页面翻转效果。
如何在UIScrollview
中赋予页面翻转效果?
注意:在UIScrollview中,当我们改变Page时,向前和向后滚动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 委托(delegate)时使用此代码。
关于iphone - 如何在 `UIScrollview` 中提供翻页效果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10022973/