The bounds of a button don't work with text #25
Comments
That way, your code controls the the title label directly and can shimmer just that part of it. Let me know if that helps! |
my
It didn't change anything. Maybe I misunderstood you? |
I'm suggesting that you don't use the button's title at all — instead, you create your own shimmering title label and add it to the button. Your code there looks good, but you'll want to configure the |
That behavior is as expected: the content layer will fill the entire shimmering layer. If you want to position the content differently, I'd suggest adjusting how you position the shimmeringn layer to take up the same area that you want the content in. |
The problem here is that with UILabel, when you have multiple lines, filling the entire shimmering layer means that the text will always be in the center, and there will be no possible way to align it anymore. |
If you adjust the label size to match the size of the text inside, you can position it vertically wherever is appropriate. The |
That was one of the first things we tried, but it did not seem to work. We will try again to see if there is anything we did wrong. Thanks! On a side note: you guys are releasing awesome projects in github. Excellent work! |
I'm trying to get Shimmer on a programmatically added button. It's a QBFlatButton,
userStateButton = [[QBFlatButton alloc] initWithFrame:CGRectMake((cellView.frame.size.width - (80 + 20)), (self.screenHeight/(cellCount * 4)), 80, ((self.screenHeight + (cellCount * cellCount))/(cellCount * 2)))];
When I turn Shimmer on, the entire bounds that I've set for the button start shimmering (no surprise there, thats what I set the bounds as) so it looks like theres a rectangle around the logout button
FBShimmeringView *shimmeringView = [[FBShimmeringView alloc] initWithFrame:userStateButton.bounds];
How would I get just the text of the button to shimmer? I've already tried making the frame of the shimmeringView the frame of the
titleLabel
(which it turns out is {{0, 0}, {0, 0}}Any way to do this without adding it to the storyboard like issue #8
The text was updated successfully, but these errors were encountered: