title: custom UITableViewCell not occupying the full bound of the cell?
body: <p>I was doing <a href="http://www.raywenderlich.com/21842/how-to-make-a-gesture-driven-to-do-list-app-part-13" rel="nofollow">this tutorial</a> and I couldn't get the results I wanted, in a part of it.</p>
  
  <p>I subclassed the <code>UITableViewCell</code> and customized the cell directly because I wanted to add a gradient effect to each cell. Basically, I added gradient effect at the top and bottom of each cell.</p>
  
  <p>Here is the code I have used for it:</p>
  
  <pre><code>- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  {
      self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
      if (self) {
          // add a layer that overlays the cell adding a subtle gradient effect
          gradientLayer = [CAGradientLayer layer];
          gradientLayer.frame = self.bounds;
          gradientLayer.colors = @[(id)[[UIColor colorWithWhite:1.0f alpha:0.2f] CGColor],
          (id)[[UIColor colorWithWhite:1.0f alpha:0.1f] CGColor],
          (id)[[UIColor clearColor] CGColor],
          (id)[[UIColor colorWithWhite:0.0f alpha:0.1f] CGColor]];
          gradientLayer.locations = @[@0.00f, @0.01f, @0.95f, @1.00f];
          [self.layer insertSublayer:gradientLayer atIndex:0];
      }
      return self;
  }
  -(void) layoutSubviews{
     [super layoutSubviews];
  
     //ensure that gradient layers occupy the full bounds
     gradientLayer.frame = self.bounds;
  }
  </code></pre>
  
  <p>As a desired result, I want to see the gradientLayer occupying the full bounds of the cell. However, it only occupies like 1mm from the start and end of the cell. So, its not occupying the full bounds.</p>
  
  <p>If I comment out the <code>[super layoutSubviews]</code> it shows the full gradient, which occupies the full bounds of the cell. But this time, it doesn't show the texts inside the cells.</p>
  
  <p>I couldn't solved it. Any help appreciated.</p>