Animate intrinsicContentSize changes

后端 未结 6 901
借酒劲吻你
借酒劲吻你 2021-01-30 08:15

I have a UIView subclass that draws a circle whose radius changes (with nice bouncy animations). The view is deciding the size of the circle.

I want this UIView subclass

6条回答
  •  渐次进展
    2021-01-30 08:58

    None of this has worked for me. I have a UILabel which I am setting with a NSAttributedString. The text is multiline and wrapping on word boundaries. Therefore the height is variable. I've tried this:

    [UIView animateWithDuration:1.0f animations:^{
        self.label = newLabelText;
        [self.label invalidateIntrinsicContentSize];
        [self.view setNeedsLayout];
        [self.view layoutIfNeeded];
    }];
    

    And a number of variations. None work. The label immediately changes it's size and then slides into it's new position. So the animation of the labels position ons screen is working. But the animating of the label's size change is not.

提交回复
热议问题