I have a custom cell which looks like this
Cell
-ContainingView (called cellframe)
–Label
–Label
The reason for the containing view is so that I can set a shadow around the cell.
below is my code
#import "QuickNoteMasterViewCell.h"
#import <QuartzCore/QuartzCore.h>
@interface QuickNoteMasterViewCell ()
@property (nonatomic, strong) CAShapeLayer *shapeLayer;
@end
@implementation QuickNoteMasterViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
-(void)setEditing:(BOOL)editing{
}
// this adds shadow and border to the cell
- (void)configureBackgroundView
{
UIView *cellFrame = self.cellFrame;
//cellFrame.layer.borderColor = [UIColor whiteColor].CGColor;
//cellFrame.layer.borderWidth = 10.;
CGSize size = cellFrame.bounds.size;
CGFloat curlFactor = 15.0f;
CGFloat shadowDepth = 5.0f;
cellFrame.layer.shadowColor = [UIColor blackColor].CGColor;
cellFrame.layer.shadowOpacity = 1.f;
cellFrame.layer.shadowOffset = CGSizeMake(.0f, 3.0f);
cellFrame.layer.shadowRadius = 3.0f;
cellFrame.layer.masksToBounds = NO;
UIBezierPath *path = [UIBezierPath bezierPath];
[path moveToPoint:CGPointMake(0.0f, 0.0f)];
[path addLineToPoint:CGPointMake(size.width, 0.0f)];
[path addLineToPoint:CGPointMake(size.width, size.height + shadowDepth)];
[path addCurveToPoint:CGPointMake(0.0f, size.height + shadowDepth)
controlPoint1:CGPointMake(size.width - curlFactor, size.height + shadowDepth - curlFactor)
controlPoint2:CGPointMake(curlFactor, size.height + shadowDepth - curlFactor)];
cellFrame.layer.shadowPath = path.CGPath;
}
- (void)layoutSubviews
{
[super layoutSubviews];
[self configureBackgroundView];
}
@end

The problem is that when I reorder the cells, the ContainingView (called cellframe)
gets removed.

Any ideas how to fix?
When a UITableViewCell is reordered, the TableView will hide everything that’s not a UILabel or UIImageView.
Not quite sure why it does this, but I don’t know of any way around it.
The only way I know will work is to create your shadowed view as an image and switching your UIView for a UIImageView.
Sorry!