简体   繁体   中英

Get a point's colour on a UIView that is animating

I can get the colour on a point of a view as proposed in https://stackoverflow.com/a/25956283/99214 by @jack-song . However when I animate the 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

})

I cannot get the colour of the point as the view moves. How can I get the point when the view is moving?

使用视图层的presentationLayer属性,因为如果我们在MVC模式中看到,则将在动画之前和之后都拥有模型,因为核心动画类在MVC模式中是模型,因此如果要获取动画之间的值,请使用表示层

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM