如何旋转.transitionCurlDown动画来获取书页的旋转(水平,而不是垂直),与此相同:
有垂直翻页动画:
UIView.transition(with: self.myView, duration: 0.7,
options: .transitionCurlDown, animations: {
})
重要提示:我不想在 UIViewController 或 UIPageController 之间使用过渡,我想在当前屏幕上的 UIView 上应用动画。
最佳答案
解决方案:
func animatePage(side: PageCurl, textView: UITextView) {
UIView.animate(withDuration: 0.3, animations: {
let animation = CATransition()
animation.duration = 0.3
animation.startProgress = 0.0
animation.endProgress = 1
animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
animation.type = CATransitionType(rawValue: "pageCurl")
if side == .left {
animation.subtype = CATransitionSubtype(rawValue: "fromLeft")
} else {
animation.subtype = CATransitionSubtype(rawValue: "fromRight")
}
animation.isRemovedOnCompletion = false
animation.isRemovedOnCompletion = false
textView.layer.add(animation, forKey: "pageFlipAnimation")
})
}
用途:
animatePage(side: .left, textView: myTextView)
关于ios - 如何旋转.transitionCurlDown动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52866956/