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.53k stars 1.1k forks source link

Skeleton height on single line labels #418

Closed dahuggin closed 3 years ago

dahuggin 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

Filling out the following details about bugs will help us solve your issue sooner.

SkeletonView Environment:

SkeletonView version: 1.21.0 Xcode version: 12.5.1 **Swift version: 5

Steps to reproduce:

I might be missing something, but I can't get the skeleton to fill the full height of my labels when the label only has one line of text.

  1. I tried changing the .skeletonLineSpacing to 0, which works on multi line labels, but has no effect on single line labels.
  2. I tried editing the .skeletonPaddingInsets and .lastLineFillPercent to no effect.

Note: this happens whether the labels .numberOfLines is 1 or 0 as long as there is only one line of text.

In the attached screen shot, I have a UIImageView on the left and a UILabel on the right and they have equal heights. How do I make the label's skeleton fill the whole label frame?

Expected result:

Skeleton to equal height of UILabel frame

Actual result:

Skeleton has static height

Attachments:

Screen Shot 2021-07-07 at 5 05 20 PM
Juanpe commented 3 years ago

Hi @dahuggin,

Could you try to reduce the default height of each line SkeletonAppearance.default.multilineHeight = 10?

dahuggin commented 3 years ago

Thanks @Juanpe, I am able to change the skeleton height using this method, but I have multiple labels with different heights, so setting a static skeleton height doesn't really provide the solution I need.

Juanpe commented 3 years ago

The library takes the font height to calculate the height of each line...this label has a large font size?

A good solution would be to allow defining a line height for each label, but now it's not possible

dahuggin commented 3 years ago

It's not a particularly large font size, I was working with a screen that has labels ranging from 16 to 24 pt font. It would be nice to specify line height for each label. Either way, I have submitted the work and am onto the next thing. Thanks for your help :)

Juanpe commented 3 years ago

Oh sorry :/ I'll close this issue then