Reputation: 3970
I'm using this answer to create a gradient background for a table view cell
How to make gradient background in UITableViewCell in iOS?
-(void)addGradientBackgroundWithColor:(UIColor *)color {
if (!self.gradientLayer) {
self.gradientLayer = [CAGradientLayer layer];
self.gradientLayer.frame = self.bounds;
self.gradientLayer.startPoint = CGPointMake(0.0f, 0.5f);
self.gradientLayer.endPoint = CGPointMake(1.0f, 0.5f);
}
self.gradientLayer.colors = @[(id)[[color hmf_makeLightHighlight] CGColor], (id)[[UIColor whiteColor] CGColor]];
[self.layer insertSublayer:self.gradientLayer atIndex:0];
}
The problem is that when I do a swipe to delete gesture, the gradient layer seems to cover the delete button.
Is there a way to fix this?
Upvotes: 1
Views: 304
Reputation: 3970
Adding this fixed my issue
- (void)layoutSubviews {
// resize your layers based on the view's new bounds
self.gradientLayer.frame = self.bounds;
}
Upvotes: 1
Reputation: 352
I guess that you insert gradient layer into UITableViewCell. I think insert into contentView of UITableViewCell may solve your problem.
Upvotes: 0