部分pagecurl动画与swift

Pat*_*cks 3 xcode uiview page-curl ios swift

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

问题是我不知道该怎么做.我找到了一些教程,但仅针对目标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];

                     }
     ];
Run Code Online (Sandbox Code Playgroud)

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

Kem*_*nak 6

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)
})
Run Code Online (Sandbox Code Playgroud)


小智 0

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

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