gpt4 book ai didi

ios - swift 的部分 pagecurl 动画

转载 作者:搜寻专家 更新时间:2023-10-31 22:05:52 30 4
gpt4 key购买 nike

我正在寻找一种方法来指示 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/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com