-2

在此处输入图像描述

人字形之间的距离受 UITableViewCell 的宽度影响。如果小于 320,它会更大。

为了清楚起见,我故意将 contentView 的背景设置为绿色。

设置 UITableViewCell 的背景会使单元格不可见。

当表格处于编辑模式时,只有第一个 V 形变为移动单元格标志。

在此处输入图像描述

注意:我所有的 UITableViewCell 类都是使用特殊技术创建的。基本上我用 UITableViewCell 加载 xib,然后我要创建的单元格吸收该 UITableViewCell 的属性

这是完整的代码:

-(id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if (self) {
        //[self vLoadMainBundle];
        //self=(BGBaseTableViewCell *)self.view;
        [self BaseInitialize];
    }
    return self;

}


- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self BaseInitialize];
        //[self vLoadMainBundle];
        //self=(BGBaseTableViewCell *)self.view;
    }
    return self;
}

-(void) vLoadMainBundle
{
    if ([self class] == [BGBaseTableViewCell class])
    {
        return;
    }

    NSString * className = NSStringFromClass([self class]);

    [[NSBundle mainBundle] loadNibNamed:className owner:self options:nil];
}
-(void) vAfterLoadMainBundle
{
    //self=self.view;

    self.contentView.frame =self.view.contentView.frame;
    self.frame=self.view.frame;
    //self.contentView.frame=self.contentView.frame;

    [self.contentView kidnapChildrenAndAttributes:self.view.contentView];
    [self kidnapChildrenAndAttributes:self.view];
    self.editingAccessoryType= self.view.editingAccessoryType;
    self.accessoryType = self.view.accessoryType;
    self.selectionStyle =self.view.selectionStyle;

    //PO1(@(self.editingAccessoryType));
    //PO1(@(self.accessoryType));
    //PO1(@(self.selectionStyle));
    while (false);

    [self.view removeFromSuperview];
    //self.view=nil;
    PO(self.view);
    PO(self.view.subviews);
    self.view.hidden=true;
    [self furtherCustomInitializer];
}
-(void)BaseInitialize
{
    [self vLoadMainBundle];
    [self vAfterLoadMainBundle];
}

在 iOS 6 上完美运行

我注意到我画东西的原始视图仍在绘制中。因此,

4

1 回答 1

1

我在参考中找不到任何内容,但我认为这正是附件视图在 iOS 7 上的工作方式。您可以通过提供要在附件视图中显示的自定义图像来解决此问题。像这样:

myCell.accessoryView = [[ UIImageView alloc ] 
                   initWithImage:[UIImage imageNamed:@"Something" ]];

这也在这里描述:如何在 UITableViewCell 中自定义附件披露图像?

于 2013-10-11T08:29:26.800 回答