title: Shadow in UITableViewCell moving from bottom to top on scroll up
body: <p>I have a UITableView with custom cells that I want to have bottom shadows / drop shadows. For that I use this code:</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  
      static NSString *cellIdentifier = @"cell";
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"myTableViewCell" forIndexPath:indexPath];
  
      cell.layer.shouldRasterize = YES;
      cell.layer.rasterizationScale = [UIScreen mainScreen].scale;
      cell.layer.shadowColor = [[UIColor blackColor] CGColor];
      cell.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
      cell.layer.shadowRadius = 1.0f;
      cell.layer.shadowOpacity = 1.0f;
  
      CGPathRef shadowPath = [UIBezierPath bezierPathWithRect:cell.bounds].CGPath;
      cell.layer.shadowPath = shadowPath;
  
      return cell;
  }
  </code></pre>
  
  <p>When the tableview is scrolled down or hasn't been scrolled at all, the shadows look as intended:
  <a href="http://oi62.tinypic.com/ev1gn4.jpg" rel="nofollow">http://oi62.tinypic.com/ev1gn4.jpg</a></p>
  
  <p>However, whenever it is scrolled up, the shadows are moved from the bottom of the cells to the top:
  <a href="http://oi60.tinypic.com/2r4kdjl.jpg" rel="nofollow">http://oi60.tinypic.com/2r4kdjl.jpg</a></p>
  
  <p>I suspect it has something to do with the shadows being rendered each time the tableview is scrolled, but I don't know how to solve it.</p>
  
  <p>Where am I going wrong?</p>
  
  <p>Thanks a lot in advance.</p>