开发者

Having a button animate whilst being dragged

开发者 https://www.devze.com 2023-02-16 02:42 出处:网络
I have a开发者_运维百科 button that gets dragged around the screen. Upon moving it above a certain point, it grows in size, but unfortunately because it doesn\'t auto-update the position as it\'s anim

I have a开发者_运维百科 button that gets dragged around the screen. Upon moving it above a certain point, it grows in size, but unfortunately because it doesn't auto-update the position as it's animating, it appears stuck for the animation time, and is just jumpy.

Anybody got any idea how it can continue to follow the user's finger whilst still growing?


If you are scaling a UIView you shouldn't try to animate the position of the same UIView at the same time. This is because the UIView is animating its frame property as well as its scale (it animates from the center, so this makes sense).

I would wrap the button in another UIView, and animate the position of the wrapped view, while allowing the button view to animate the scale.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号