ios - swift 的部分 pagecurl 动画

标签 ios swift xcode uiview page-curl

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

问题是我不知道该怎么做。我找到了一些教程,但仅针对 objective-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)
})

关于ios - swift 的部分 pagecurl 动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39616857/

相关文章:

iphone - 将图像添加到 iPhone 模拟器相册 - 已接受 "tricks"不起作用

swift - 在自定义注释 mapkit swift 4 前面/下面添加标题

swift - Swift 4 中 Codable 协议(protocol)的自定义字典编码器和解码器

ios - NSBlock 什么时候被释放?

objective-c - 如何在 iOS/Cocoa 应用程序中安全地包含 key /签名

ios - 使用未解析的标识符 'FlurryAdInterstitial'

ios - 无法在 xcode 5.1.1 中运行 iOS 7.1.2 设备

ios - 带有约束的 Swift TextView 不可见

xcode - 如何使用第三方库: SWXMLHash in the playground ?

ios - 使用 Hpple 在 Xcode 中解析 xml