【问题标题】:Animate a change in UIFont size动画 UIFont 大小的变化
【发布时间】:2011-05-26 07:19:44
【问题描述】:

有没有办法让某些文本的字体大小发生变化。我正在考虑从 UIView 的子类调用 drawRect 并以不同的大小绘制文本。

【问题讨论】:

标签: iphone objective-c animation uiview core-animation


【解决方案1】:

您可以在任何 UIView (包括标签)上为转换设置动画。

[UIView beginAnimations:nil context:nil];
label.transform = CGAffineTransformMakeScale(1.5,1.5);
[UIView commitAnimations];

这会将文本放大到 150%。如果你把它弄得太大,它可能会变得块状。

【讨论】:

  • 美丽。将它与阴影配对,看起来文字真的跳出来了。这是一个整洁的效果。感谢代码 skorulis。
【解决方案2】:

你试过了吗?

[UIView beginAnimations:nil context:self.view];
[UIView setAnimationDuration:0.5];
label.font = [UIFont font...]; //try setting the font and the size you want
[UIView commitAnimations];

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-07-17
  • 1970-01-01
  • 2017-11-24
  • 2019-08-04
相关资源
最近更新 更多