CAAnimation 完后属性不更新问题

本文介绍如何在Core Animation中使用presentationLayer方法获取CALayer在动画结束后的最新状态,确保层属性与显示一致。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

对一CALayer 使用动画后,虽然动画结束,但相应的属性值并没有更新,,此时可以使用如下方法拿回一个当前的layer 的最新状态。



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.

- (id)presentationLayer
Return Value
A layer instance representing the current presentation layer.

Discussion
This method provides a close approximation to the version of the layer that is currently being displayed. The sublayers, mask, and superlayer properties of the returned layer return the presentation versions of these properties. This pattern carries through to the read-only layer methods. For example, sending a hitTest: message to the presentationLayer will query the presentation values of the layer tree.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值