Giter Club home page Giter Club logo

Comments (12)

grp avatar grp commented on June 27, 2024

You should be able to use Shimmer with a button, but it might not work if you try and use it with one part of a button. In this case, trying to pull out the titleLabel from the button might not work.

Instead, you could try using the button itself as the content of the shimmering view:

shimmeringView.contentView = self.loginBt;

That way, the button's title can stay within the button itself. Let me know if that helps!

from shimmer.

grp avatar grp commented on June 27, 2024

Here's an example it looks like for me with a rounded-rect button shimmering:
screen shot 2014-03-06 at 11 02 26 am

from shimmer.

eikebartels avatar eikebartels commented on June 27, 2024

Hey,

now I found a good looking solution for me.

I added a UIButton via Storyboard and the below.

   FBShimmeringView *shimmeringView = [[FBShimmeringView alloc] initWithFrame:self.loginBt.bounds];
    shimmeringView.alpha = 0.5;
    [self.loginBt addSubview:shimmeringView];

    UIView * v = [[UIView alloc] initWithFrame:shimmeringView.bounds];
    [v setBackgroundColor:[UIColor whiteColor]];


    shimmeringView.contentView = v;

    // Start shimmering.
    shimmeringView.shimmering = YES;

Cheers

from shimmer.

obrhoff avatar obrhoff commented on June 27, 2024

I good similar problems. In my subclassed UIButton I added this code. The button starts to shimmer as expected but it stops reacting to touches.

[self.titleLabel removeFromSuperview];
self.shimmeringView = [[FBShimmeringView alloc] initWithFrame:self.bounds];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.shimmeringView.contentView = self.titleLabel;
[self addSubview:self.shimmeringView];

from shimmer.

sukit0924 avatar sukit0924 commented on June 27, 2024

เมื่อ 21 เม.ย. 2014 13:33 "Dennis Oberhoff" [email protected]
เขียนว่า:

I good similar problems. In my subclassed UIButton I added this code. The
button starts to shimmer as expected but it stops reacting to touches.

[self.titleLabel removeFromSuperview];
self.shimmeringView = [[FBShimmeringView alloc] initWithFrame:self.bounds];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.shimmeringView.contentView = self.titleLabel;
[self addSubview:self.shimmeringView];


Reply to this email directly or view it on GitHubhttps://github.com//issues/8#issuecomment-40919070
.

from shimmer.

grp avatar grp commented on June 27, 2024

@DocterD I think it's likely that your shimmering view is covering up taps on the button. Maybe set userInteractionEnabled = NO on the shimmering view so it can't claim touches?

from shimmer.

obrhoff avatar obrhoff commented on June 27, 2024

I think I already tried this. Afaik userInteractionEnabled applies to all subviews.

from shimmer.

grpaul avatar grpaul commented on June 27, 2024

Right, you'd disable interaction on the shimmering view so touches can fall through to the button.

If you're still having issues, I would avoid shimmering internal subviews of UIButton. Instead, try shimmering the entire button as the contentView or a manually created label.

from shimmer.

sukit0924 avatar sukit0924 commented on June 27, 2024

เมื่อ 21 เม.ย. 2014 23:23 "Now at @grp" [email protected] เขียนว่า:

Right, you'd disable interaction on the shimmering view so touches can
fall through to the button.

If you're still having issues, I would avoid shimmering internal subviews
of UIButton. Instead, try shimmering the entire button as the contentViewor a manually created label.


Reply to this email directly or view it on GitHubhttps://github.com//issues/8#issuecomment-40948789
.

from shimmer.

sukit0924 avatar sukit0924 commented on June 27, 2024

เมื่อ 21 เม.ย. 2014 23:21 "Dennis Oberhoff" [email protected]
เขียนว่า:

I think I already tried this. Afaik userInteractionEnabled applies to all
subviews.


Reply to this email directly or view it on GitHubhttps://github.com//issues/8#issuecomment-40948625
.

from shimmer.

eikebartels avatar eikebartels commented on June 27, 2024

if someone has still trouble here my code

-(id)initWithCoder:(NSCoder *)aDecoder{
    self = [super initWithCoder:aDecoder];
    if (self) {
        self.shimmeringView = [[FBShimmeringView alloc] initWithFrame:self.bounds];
        [self addSubview:self.shimmeringView];
        self.shimmeringView.userInteractionEnabled = NO;

        self.shimmeringView.contentView = self.titleLabel;
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
    }
    return self;
}

from shimmer.

hsleedevelop avatar hsleedevelop commented on June 27, 2024

eikebartels, it's great.
your code is working perfectly in my case. thank you.

from shimmer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.