UIView animation determine center during animation

前端 未结 2 1038
滥情空心
滥情空心 2021-01-24 23:22

I\'m using UIView\'s + animateWithDuration:delay:options:animations:completion: method to move my view along a line over the course of a few seconds or so.

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-25 00:17

    UIViews are backed by CALayers, and it is the layer that does the actual animation. CALayer exposes a property presentationLayer which, when accessed, returns a copy of the CALayer that represents, as closely as it can, the current state visible to the user. By asking for the view.layer.presentationLayer.frame you can get the frame of the layer as visible to the user right now, and this corresponds to the frame of the UIView.

提交回复
热议问题