Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting a background image in SVSegmentedThumb overlaps the SVSegmentedControl #38

Open
marcomempin opened this issue Jan 16, 2013 · 3 comments

Comments

@marcomempin
Copy link

Tab Bar

When i set a backgroundImage in self.segmentedControl.thumb, this happens.

@marcomempin
Copy link
Author

I looked inside SVSegmentedThumb.m, and by trial and error, i managed to get the "correct" subtrahend for the height of the imageView:

    - (UIImageView *)thumbBackgroundImageView {
        if(!_thumbBackgroundImageView) {
            _thumbBackgroundImageView = [[UIImageView alloc] initWithFrame:CGRectMake(5+self.segmentedControl.thumbEdgeInset.left,
                                                                                      self.segmentedControl.thumbEdgeInset.top,
                                                                                      self.bounds.size.width-10-self.segmentedControl.thumbEdgeInset.left-self.segmentedControl.thumbEdgeInset.right,
                                                                                      self.backgroundImage.size.height - 3)];
            _thumbBackgroundImageView.backgroundColor = [UIColor clearColor];
            [self insertSubview:_thumbBackgroundImageView atIndex:0];

            self.clipsToBounds = NO;
            self.segmentedControl.clipsToBounds = NO;
        }
        return _thumbBackgroundImageView;
    }

@samvermette
Copy link
Owner

Did you try playing around with thumbEdgeInset?

@samvermette
Copy link
Owner

Also forgot to mention that this is by design so implementations like this one can be made possible:

Screen Shot 2013-02-01 at 6 39 01 PM

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

No branches or pull requests

2 participants