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

How To: Update background gradient when UITableView scrolls #25

Closed
Jamongkad opened this issue Apr 23, 2015 · 2 comments
Closed

How To: Update background gradient when UITableView scrolls #25

Jamongkad opened this issue Apr 23, 2015 · 2 comments

Comments

@Jamongkad
Copy link

Hello! Awesome library btw. I ran into an issue which I think can easily be solved but my brain isn't working too right at the moment. I have a UITableView that has over a 100+ cells. Easy enough to apply a gradient to the TableView background. The problem starts when I scroll down the gradient doesn't scroll with the content. Basically it clips at a certain point and starts over again when the tableview cells are reused.

Here's my code. I use the tableView's frame...

- (void)updateGradient {
    UIColor *gradientBG = [UIColor colorWithGradientStyle:UIGradientStyleTopToBottom
                                            withFrame:self.tableView.frame
                                            andColors:@[[UIColor flatBlueColor], [UIColor lightGrayColor]]];

    [self.tableView setOpaque:NO];
    [self.tableView setBackgroundColor:[UIColor clearColor]];
    [self.view setBackgroundColor:gradientBG];
}
@vicc
Copy link
Owner

vicc commented Apr 29, 2015

Thanks for the kind words @Jamongkad and sorry for the late reply. Just to make sure I understand you correctly, are you attempting to set a gradient background on each individual cell?

@vicc
Copy link
Owner

vicc commented May 8, 2015

@Jamongkad I'm going to go ahead and close this for now due to the lack of activity, but if you're still having any issues feel free to reopen one. 😃

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

No branches or pull requests

2 participants