このようなカスタムセルがあります
細胞
-ContainingView (セルフレームと呼ばれる)
- ラベル
- ラベル
包含ビューの理由は、セルの周りに影を設定できるようにするためです。
以下は私のコードです
#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
問題は、セルを並べ替えると、ContainingView (セルフレームと呼ばれる) が削除されることです。
修正方法はありますか?