Skip to content
This repository has been archived by the owner on Aug 12, 2021. It is now read-only.

Applying shimmer to text in UIButton #8

Open
Advozium opened this issue Jan 6, 2020 · 0 comments
Open

Applying shimmer to text in UIButton #8

Advozium opened this issue Jan 6, 2020 · 0 comments

Comments

@Advozium
Copy link

Advozium commented Jan 6, 2020

I have a question about the use case where I'd like to add a shimmer to the label of a UIButton. The problem is that when I add the Shimmer as a subview to the button, and then apply the shimmer to the UILabel in the button, the text shrinks. I'm doing the following in my function to initialise the shimmering view:

let shimmerView = ShimmeringView(frame: self.Button.titleLabel!.frame)
Button.addSubview(shimmerView)
shimmerView.contentView = self.Button.titleLabel!
shimmerView.isShimmering = true
shimmerView.shimmerSpeed = 50

The end result is shown below:

Simulator Screen Shot - iPhone Xʀ - 2020-01-06 at 11 25 31

Having taken a look, I noticed that the text label inside the button is shrinking. Is this the intended behaviour for the Shimmer view, or is there another way of setting it up so that I can have the text label shimmer and sized properly inside a button?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant