我正在尝试使用动画来增加标签的高度,但是动画会使标签首先从中心扩展,然后以正确的y点跳到适当位置。这看起来很糟糕。我只想扩大底部。

[UIView animateWithDuration:0.5 delay:0.0f options:UIViewAnimationOptionTransitionNone animations:^{

   [self.about increaseHeightFromTopLeft:deltaHeight];

   [self.scrollView increaseContentHeight];

} completion:nil];


- (void)increaseHeightFromTopLeft:(CGFloat ) increased  {

    CGRect newFrame = CGRectMake(self.originX, self.originY, self.frameWidth, self.frameHeight + increased);

    self.frame = newFrame;
}

标签被称为“约”,您可以在此处看到动画的视频。 https://www.youtube.com/watch?v=DcqktIZ9moY&feature=youtu.be

最佳答案

面临同样的问题!
尝试在代码中将标签的contentMode设置为Top:

label.contentMode = UIViewContentModeTop;

关于ios - UILabel更改高度,动画从中心扩展,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25982957/

10-14 20:50
查看更多