Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 使用swift的部分pagecurl动画_Ios_Swift_Xcode_Uiview_Page Curl - Fatal编程技术网

Ios 使用swift的部分pagecurl动画

Ios 使用swift的部分pagecurl动画,ios,swift,xcode,uiview,page-curl,Ios,Swift,Xcode,Uiview,Page Curl,我正在寻找一种在uiview上指示pagecurl动画的方法,以向用户提示他可以滚动某些页面。它应该是某种局部的页面卷曲 问题是我不知道怎么做。我找到了一些教程,但只针对目标c,我不知道如何将其转换为swift: [UIView animateWithDuration:1.0 animations:^{ CATransition * animation = [CATransition animatio

我正在寻找一种在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];

                     }
     ];

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


为了您的帮助,我已经将相同的代码升级到最新版本

UIView.animate(withDuration: 1.0, animations: {
        let animation = CATransition()
        animation.duration = 1.2
        animation.startProgress = 0.0
        animation.endProgress = 0.6
        animation.type = CATransitionType(rawValue: "pageCurl")
        animation.subtype = CATransitionSubtype(rawValue: "fromRight")
        animation.isRemovedOnCompletion = false
        animation.fillMode = CAMediaTimingFillMode(rawValue: "extended")
        animation.isRemovedOnCompletion = false
        if let animation = animation as? CATransition{
            self.view.layer.add(animation, forKey: "pageFlipAnimation")
            self.viewDidLoad()
        }
        self.view.addSubview(self.TableView)
    })

我已经做过了。现在,我想在第一页上显示一些类似于摘要的内容,以向用户显示还有更多的页面,他可以滚动浏览。就像右下角的一个小边缘,有点卷曲。我听到了。我在我的项目中实现这一点的方式是使用带有卷曲图像背景的UIButton,当用户按下该按钮时,它将触发卷曲动画。@Leena我调用viewdidload,因为我正在同一页面上加载另一个数据,您可以根据自己的选择进行修改
UIView.animate(withDuration: 1.0, animations: {
        let animation = CATransition()
        animation.duration = 1.2
        animation.startProgress = 0.0
        animation.endProgress = 0.6
        animation.type = CATransitionType(rawValue: "pageCurl")
        animation.subtype = CATransitionSubtype(rawValue: "fromRight")
        animation.isRemovedOnCompletion = false
        animation.fillMode = CAMediaTimingFillMode(rawValue: "extended")
        animation.isRemovedOnCompletion = false
        if let animation = animation as? CATransition{
            self.view.layer.add(animation, forKey: "pageFlipAnimation")
            self.viewDidLoad()
        }
        self.view.addSubview(self.TableView)
    })