【发布时间】:2012-10-25 18:15:06
【问题描述】:
增加标签高度时,一切都很好。减小时,标签会立即改变大小,然后通过动画重新定位。
@interface
@property (nonatomic, retain) IBOutlet UILabel *explanationLabel;
@implementation
CGRect frmExpl = explanationLabel.frame;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.75];
frmExpl.size.height -= height;
explanationLabel.frame = frmExpl;
[UIView commitAnimations];
我试过用 UIView 替换 UILabel,当然 UIView 没有这样的问题。
有什么特殊的方法可以让 UILabel 尺寸减小吗?
这是一个演示所描述问题的最小项目。 Download
【问题讨论】:
-
你从哪里得到 frmExpl?
-
来自标签的框架,在 nib 文件中设计。已更新。