Search code examples
ioscalayer

Can't seem to add a sublayer to my UITableViewCell subclass


This code is run from within a subclass of UITableViewCell

CALayer* greenLayer = [CALayer layer];
greenLayer.backgroundColor = [UIColor greenColor].CGColor;
CGRect frame = CGRectMake(0, 0, 320, self.bounds.size.height);
greenLayer.frame = frame;
[self.backgroundView.layer addSublayer:greenLayer];

But nothing happens


Solution

  • It was another piece of code which caused the problem. I was retrieving the cell incorrectly.