部分pagecurl动画与swift

我正在寻找一种在uiview上指示pagecurl动画的方法,以便向用户提供他可以滚动浏览某些页面的提示。 它应该是某种部分页面curl。

问题是我不知道该怎么做。 我发现了一些教程,但仅针对目标c,我不知道如何将其转换为swift:

[UIView animateWithDuration:1.0 animations:^{ CATransition * animation = [CATransition animation]; [animation setDuration:1.2f]; animation.startProgress = 0.0; animation.endProgress = 0.6; [animation setTimingFunction:UIViewAnimationCurveEaseInOut]; [animation setType:@"pageCurl"]; [animation setSubtype:@"fromRight"]; [animation setRemovedOnCompletion:NO]; [animation setFillMode: @"extended"]; [animation setRemovedOnCompletion: NO]; [[self.animatedUIView layer] addAnimation:animation forKey:@"pageFlipAnimation"]; [self.animatedUIView addSubview:tempUIView]; } ]; 

http://www.iostute.com/2015/04/how-to-implement-partial-and-full-page.html

 UIView.animate(withDuration: 1.0, animations: { let animation = CATransition() animation.duration = 1.2 animation.startProgress = 0.0 animation.endProgress = 0.6 animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut) animation.type = "pageCurl" animation.subtype = "fromRight" animation.isRemovedOnCompletion = false animation.fillMode = "extended" self.animatedUIView.layer.add(animation, forKey: "pageFlipAnimation") self.animatedUIView.addSubview(tempUIView) }) 

我想你可以使用UIPageViewController。 我为我的项目做了类似的事情。 本教程很有帮助。

https://spin.atomicobject.com/2015/12/23/swift-uipageviewcontroller-tutorial/