當除去我有它看起來像這樣自定義的UITableViewCell,初始視圖獲取重排序
細胞自定義單元格
-ContainingView(稱爲cellframe)
--label
--label
包含視圖的原因是,我可以在單元格周圍設置陰影。下面
是我的代碼
#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(稱爲cellframe) 被刪除。
任何想法如何解決?
恥辱!我想到了一個解決方案,但我一直在努力實現它。基本上我需要在容器的圖層 – totalitarian