Animating Frame of UILabel smoothly

前端 未结 5 1693
我寻月下人不归
我寻月下人不归 2020-12-06 12:23

I\'ve been trying to figure out a decent way to smoothly animate a frame size change on a UILabel, without a weird starting jump redraw. What happens by default is that when

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-06 12:36

    To expand on @cliclcly's answer: From the Overview of UILabel's documentation:

    The default content mode of the UILabel class is UIViewContentModeRedraw. This mode causes the view to redraw its contents every time its bounding rectangle changes. You can change this mode by modifying the inherited contentMode property of the class.

    From the documentation of the contentMode property of UIView:

    The default value of this property is UIViewContentModeScaleToFill.

    UILabels behave differently than other UIViews by default because their contentMode property is different by default.

提交回复
热议问题