且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在内容增长的同时为 UIView 的阴影边框设置动画

更新时间:2023-10-28 13:46:28

我正在寻找这个问题的答案,并在此处遇到了这篇文章,我相信这就是您要寻找的内容:

I was looking for an answer to exactly this problem and encountered this post here, which I believe is what you're looking for:

将 CALayer 阴影与 UITableviewCell 高度动画同时进行动画

解决方案有点冗长(我很惊讶用例如此罕见以至于不提示苹果修复(?)它)并且此时已有几年历史,但我能找到的最新版本.最终我决定通过在调整大小之前淡出阴影来解决这个问题,但您可能会发现它很有用!

The solution is a bit verbose (I'm surprised the use-case is so rare as to not prompt apple to fix(?) it) and a few years old at this point, but the most recent I could find. Ultimately I decided to work around it by fading out my shadows before resizing, but you might find it useful!

我发现的其他一些较旧的帖子似乎证实了这种效果所需的努力程度(同样,Apple 有一个奇怪的列表,它认为是您的问题),因此第一篇帖子可能是您***的打赌.

A couple of other, older posts I've found appear to corroborated the level of effort required for this effect (again, Apple's got a weird list of things it decides are your problem), so that first post is probably your best bet.

https://petosoft.wordpress.com/2012/10/24/shadowpath-not-animating-with-standard-uiview-animations-on-ipad/

使用阴影平滑旋转和更改 UIView 的大小一个>

UIView:如何为 CALayer 框架设置阴影动画?

如果您设法找到了更直接的解决方案,请务必告诉我;同时,我希望这会有所帮助.

If you've managed to find a more straightforward solution, by all means let me know; in the mean-time I hope this helps.