Animating UILabel size decrease

后端 未结 3 1364
无人及你
无人及你 2020-12-19 04:01

When increasing the height of label, everything is fine and smooth. When decreaseing, the label is instantly changing the size then repositioning with animation.

<         


        
3条回答
  •  失恋的感觉
    2020-12-19 04:36

    Use a CGAffineTransform to do this.

    [UIView animateWithDuration:1.0 animations:^{
        // Scale down 50%
        label.transform = CGAffineTransformScale(label.transform, 0.5, 0.5);
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:1.0 animations:^{
            // Scale up 50%
            label.transform = CGAffineTransformScale(label.transform, 2, 2);
        }];
    }];
    

提交回复
热议问题