lexrus / lexrus/LTMorphingLabel

Weird spacing before starting animation

Open
#138 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
8.1k
Forks
776
PR merge metrics
No merged PRs in 30d

Description

First of all, great library!

I'll introduce the problem first, check the spacing from the leftmost 3 to the comma, that spacing increases on the first animation and then stays the same. It seems like a small issue but it can be really seen when using the app.

MorphingLabel bug

I am using LTMorphingLabel inside a UITableViewCell and the only way I could find to make it work was by adding it as a subview, like this:

titleLabel?.removeFromSuperview()
titleLabel = nil

titleLabel = LTMorphingLabel()
titleLabel!.morphingEnabled = false /// If I don't implement this morphingEnabled false/true the label would animate every time it's shown
titleLabel!.delegate = self
titleLabel!.morphingEffect = .evaporate
titleLabel!.text = formattedNumber /// This is a number formatted to include a comma every 3 characters counting from the right
titleLabel!.textAlignment = .center
titleLabel!.font = UIFont(name: "Silka-SemiBold", size: 28)
titleLabelContainer.addSubview(titleLabel!)
titleLabel!.morphingEnabled = true

My first thought was maybe some attributedText could be the issue but couldn't find out why this is happening, any help would be appreciated.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the spacing change in LTMorphingLabel when it is used inside a UITableViewCell with the .evaporate effect and formatted numbers containing commas. Inspect the label's animation and text-layout path, comparing spacing before and after the first animation. Done means the comma spacing remains stable and the label does not animate unexpectedly when the cell is shown or reused.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.