gpt4 book ai didi

ios - 在动画的 UIView 上获取点的颜色

转载 作者:行者123 更新时间:2023-11-28 14:13:13 25 4
gpt4 key购买 nike

我可以按照 https://stackoverflow.com/a/25956283/99214 中的建议获得一个观点的颜色通过@jack-song。但是,当我为 View 设置动画时

let scaledAndTranslatedTransform = imageViewShape.transform.translatedBy(x: -imageViewShape.bounds.width * 2 - 200, y: 0.0)

UIView.animate(withDuration: TimeInterval(duration), animations: {
self.imageViewShape.transform = scaledAndTranslatedTransform
}, completion: { _ in

})

随着 View 的移动,我无法获取点的颜色。如何在 View 移动时获取点?

最佳答案

使用 View 层的 presentationLayer 属性,因为如果我们在 MVC 模式中看到你将在动画之前和动画之后有模型,因为核心动画类是 MVC 模式中的模型,所以如果你想获得动画之间的值,请使用表示层

关于ios - 在动画的 UIView 上获取点的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52365189/

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