iOS版 - 动画中的UILabel或UITextView的文本大小的变化? [英] iOS - Animating text size change in UILabel or UITextView?

查看:213
本文介绍了iOS版 - 动画中的UILabel或UITextView的文本大小的变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在显示文本块的应用程序,我在当设备转向了横向的字体大小增加。我不喜欢它怎么做整个动画,然后突然跳到​​新的大小,所以我想动画在旋转过程中的尺寸变化。

我读的地方,扔在一个的UIView 动画块这种变化不起作用,因为字体属性不能设置动画,所以有什么是我对做这个选择?

有关我的具体实现,我不能简单地缩放的UILabel / 的UITextView 原样;框的边界比字体尺寸增加更多(按比例),所以会有在文本重新流动。这由我很好。

编辑:我会被罚款与简单地缩放的UITextView

另外,我正在考虑动画它手动:我有一个勾画出我的意见,并为调整字体大小的方法。如果我知道,当转速为即将开始,而动画的持续时间,我可以火候所以它呈现中间字体大小或两个在动画的中间。任何帮助,让那些将AP preciated。


解决方案

  

如果我知道当旋转约
  开始,和的时间
  动画...


滑稽您应该提及。动画开始之前,你的视图控制器将获得 willAnimateRotationToInterfaceOrientation:时间:消息,为您提供所需的确切信息

In an application showing chunks of text, I'm having the font size increase when the device is turned to a landscape orientation. I don't like how it does the whole animation and then suddenly jumps to the new size, so I'd like to animate the size change over the course of the rotation.

I read somewhere that throwing this change in a UIView animation block doesn't work because the font property is not animatable, so what are my options for doing this?

For my specific implementation I'm not simply scaling the UILabel/UITextView as-is; The bounds of the box is increasing more (proportionally) than the font-size, so there will be re-flow in the text. That's fine by me.

Edit: I would be fine with simply scaling the UITextView.

Also, I was considering "animating" it manually: I have a method that lays out my views and adjusts for font size. If I knew when the rotation was about to start, and the duration of the animation, I could time it so it renders an intermediate font size or two in the middle of the animation. Any help with getting those would be appreciated.

解决方案

If I knew when the rotation was about to start, and the duration of the animation...

Funny you should mention that. Just before the animation starts, your view controller will receive a willAnimateRotationToInterfaceOrientation:duration: message that gives you the exact information you need.

这篇关于iOS版 - 动画中的UILabel或UITextView的文本大小的变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆