我在披露指标中看到了双V形。为什么以及如何解决这个问题?

时间:2013-10-11 07:43:37

标签: objective-c xcode5

enter image description here

V形之间的距离受UITableViewCell宽度的影响。如果它小于320,那就更大了。

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

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

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

enter image description here

注意:我的所有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上完美运行

我注意到,我绘制内容的原始视图仍在绘制中。因此,

1 个答案:

答案 0 :(得分:1)

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

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

这也在这里描述:How can I customize the accessory disclosure image in a UITableViewCell?

相关问题