-presentationLayer是否可以告诉我正在动画的视图的飞行中值? [英] Does the -presentationLayer tell me the in-flight values of an view while it is beeing animated?

查看:51
本文介绍了-presentationLayer是否可以告诉我正在动画的视图的飞行中值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文档说:


presentationLayer返回包含所有属性的图层
的副本,它们是
在当前
交易开始时,应用了任何有效的
动画。

presentationLayer Returns a copy of the layer containing all properties as they were at the start of the current transaction, with any active animations applied.

,表示层包含的值类似于当前向用户显示的值。因此,当我请求该图层时,为什么要告诉我在开始制作动画之前事物的外观?那没有道理。那是文档错误吗?

And somewhere else Apple said, that the presentation layer contains the values like they are currently displayed to the user. So when I ask for this layer, why would it tell me how the thing looked before starting to animate? That doesn't make sense. Is that an documentation error?

推荐答案

文档正确。他们说的是presentationLayer基于图层的初始状态,但是应用了适当的动画。随着动画的进行,presentationLayer的适当值会更改以匹配图层的当前显示状态。

The documentation is correct. What they are saying is that the presentationLayer is based on the initial state of the layer, but it has the appropriate animations applied. As the animations progress, the appropriate values of the presentationLayer change to match the currently displayed state of the layer.

例如,如果图层始于原点坐标(100, 0),然后应用动画将其移动到(200,0),在动画的一半处,presentationLayer的原点坐标为(150,0)。如果将相同的动画应用于从坐标(0,0)开始的图层,则在动画的中间,presentationLayer的原点为(100,0)。

For example, if the layer started at origin coordinate (100,0) and you applied an animation to move it to (200,0), halfway through the animation the presentationLayer's origin coordinate would be (150,0). If the same animation was applied to a layer starting at coordinate (0,0), then halfway through the animation the presentationLayer would have an origin of (100,0).

这篇关于-presentationLayer是否可以告诉我正在动画的视图的飞行中值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆