Juanpe / SkeletonView

☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
MIT License
12.59k stars 1.11k forks source link

UILabel height constraint remains after removing skeleton layer #351

Closed mdziubich closed 3 years ago

mdziubich commented 3 years ago

Description

Describe your issue here.

What type of issue is this? (place an x in one of the [ ])

Requirements (place an x in each of the [ ])


Bug Report

When using SkeletonView on UILabel that have more than one line value set on property numberOfLines skeleton adds heightConstraint in updateHeightConstraintsIfNeeded method of UILabel extension. After calling hideSkeleton and loading the text to the label the constraint is not removed which results in invalid label height.

SkeletonView Environment:

SkeletonView version: 1.11.0 Xcode version: 12.0.1 **Swift version: 5.0

Steps to reproduce:

  1. create UILabel with dynamically rendered height
  2. set UILabel numberOfLines property to 3
  3. call showAnimatedSkeleton() on UILabel
  4. call hideSkeleton() on UILabel
  5. set label text property to fit one line.

Expected result:

Label adjust its height to fit intrinsic content size.

Actual result:

Label height is set to the one calculated by SkeletonView.

StasanTelnov commented 3 years ago

Hello. I have a same problem too.

closure11 commented 3 years ago

Same problem. It seems that this was introduced in 1.11.0

sseno commented 3 years ago

Same issue, any updates?

Juanpe commented 3 years ago

Hi there! sorry for the delay, I'm checking this issue. I let you know when I have more info about that 👍

jaxxxxxxxx commented 3 years ago

label.text = "xxx" label.removeConstraint(label.constraints.last!)

You can use the code above to solve this problem, but use it with caution.

Juanpe commented 3 years ago

Hi!

This issue has been resolved, the fix will be included in the next version which will be released during this week.

Thanks for using SkeletonView :)