Animate intrinsicContentSize changes

后端 未结 6 817
借酒劲吻你
借酒劲吻你 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 09:21

    Swift version of @stigi's answer which worked for me:

    UIView.animate(withDuration: 0.2, animations: {
        self.invalidateIntrinsicContentSize()
        self.superview?.setNeedsLayout()
        self.superview?.layoutIfNeeded()
    })
    

提交回复
热议问题