且构网

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

使用UILabel调整uiview的大小和动画

更新时间:2023-01-26 13:40:45

我在一段时间之前用我描述的方式动画了我的标签,但是你必须付出一些代价。
基本思想:
- 使用clipsToBounds:YES添加标签到containerview。
- 不要为标签框架设置动画,而是为containerview的框架设置动画,以便标签具有平滑过渡。
- 为Elipsis(...)使用单独的标签,因此您也可以对此部分进行动画处理。

I animated my label the described way some time ago, but you have to put some afford in it. Basic idea: - Add the label to a containerview with clipsToBounds:YES. - Do Not animate the label frame, instead animate the frame of the containerview, so your label will have a smooth transition. - Use a seperate Label for the Elipsis (...) so you can animate this part too.