iphone表格视图两列自定义视图第二个自定义不显示图像

iphone表格视图两列自定义视图第二个自定义不显示图像,iphone,uitableview,Iphone,Uitableview,大家好,谁能告诉我我的代码出了什么事 我想使用表视图实现如下函数 图片如下 对不起:我不能在这里发布图片 一个表格单元有两个自定义视图列 自定义视图单元代码如下所示: #define kTitleFontSize 22.f #define kSummaryFontSize 13.f @implementation FunBoxView - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if

大家好,谁能告诉我我的代码出了什么事

我想使用表视图实现如下函数 图片如下

对不起:我不能在这里发布图片

一个表格单元有两个自定义视图列 自定义视图单元代码如下所示:

#define kTitleFontSize 22.f
#define kSummaryFontSize 13.f

@implementation FunBoxView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
if (self) {
    // Initialization code
     _backgroundView = [[UIImageView alloc]initWithFrame:CGRectZero];
     _backgroundView.contentMode = UIViewContentModeScaleToFill;
    [self addSubview:_backgroundView];
    _heartImageView = [[UIImageView alloc]initWithFrame:CGRectZero];
   //        _heartImageView.contentMode = UIViewContentModeScaleToFill;
    [self addSubview:_heartImageView];

    _titleLbl = [[UILabel alloc]initWithFrame:CGRectZero];
    _titleLbl.backgroundColor = [UIColor clearColor];
    _titleLbl.textAlignment = UITextAlignmentCenter;
    _titleLbl.textColor = [UIColor whiteColor];
    _titleLbl.font = [UIFont systemFontOfSize:kTitleFontSize];
    [self addSubview:_titleLbl];
    _summaryLbl = [[UILabel alloc]initWithFrame:CGRectZero];
    _summaryLbl.backgroundColor = [UIColor clearColor];
    _summaryLbl.textAlignment = UITextAlignmentCenter;
    _summaryLbl.textColor = [UIColor whiteColor];
    _summaryLbl.font = [UIFont systemFontOfSize:kSummaryFontSize];
    [self addSubview:_summaryLbl];

    _logoImageView = [[UIImageView alloc]initWithFrame:CGRectZero];
    //        _logoImageView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
    [self addSubview:_logoImageView];
}
self.contentMode = UIViewContentModeRedraw;
return self;
}

}

follow控制器调用表单元格

cell = [tableView dequeueReusableCellWithIdentifier:secondIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:secondIdentifier];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        FunBoxView * boxView = [[[FunBoxView alloc]initWithFrame:CGRectMake(0.f, 0.f, cell.frame.size.width * 2 / 3, height)]ah_autorelease];
        boxView.tag = HOMETAGBASE ;
        [boxView addTarget:self action:@selector(buttonClickedAction:) forControlEvents:UIControlEventTouchUpInside];
        [cell.contentView addSubview:boxView];
        FunBoxView * second = [[FunBoxView alloc]initWithFrame:CGRectMake(cell.frame.size.width * 2 / 3, 0.f, cell.frame.size.width / 3, height)];
        second.tag = HOMETAGBASE + 1;
        [second addTarget:self action:@selector(buttonClickedAction:) forControlEvents:UIControlEventTouchUpInside];

        [cell.contentView addSubview:second];
    }
但是我发现自定义视图图像只显示第一列 但下一秒或第三秒不会显示图像 我不知道发生了什么事


每个人都能告诉我吗?

我像你说的那样改变了,但没用我自己解决问题。这是由观景中心@Tapan Nathvani引起的
    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:secondIdentifier];

if (cell == nil) 
{
    cell.selectionStyle = UITableViewCellSelectionStyleNone;

}

FunBoxView * boxView = [[[FunBoxView alloc]initWithFrame:CGRectMake(0.f, 0.f,     cell.frame.size.width * 2 / 3, height)]ah_autorelease];
      boxView.tag = HOMETAGBASE ;
    [boxView addTarget:self action:@selector(buttonClickedAction:) forControlEvents:UIControlEventTouchUpInside];
    [cell.contentView addSubview:boxView];
    FunBoxView * second = [[FunBoxView alloc]initWithFrame:CGRectMake(cell.frame.size.width * 2 / 3, 0.f, cell.frame.size.width / 3, height)];
    second.tag = HOMETAGBASE + 1;
    [second addTarget:self action:@selector(buttonClickedAction:) forControlEvents:UIControlEventTouchUpInside];

    [cell.contentView addSubview:second];

return cell;
    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:secondIdentifier];

if (cell == nil) 
{
    cell.selectionStyle = UITableViewCellSelectionStyleNone;

}

FunBoxView * boxView = [[[FunBoxView alloc]initWithFrame:CGRectMake(0.f, 0.f,     cell.frame.size.width * 2 / 3, height)]ah_autorelease];
      boxView.tag = HOMETAGBASE ;
    [boxView addTarget:self action:@selector(buttonClickedAction:) forControlEvents:UIControlEventTouchUpInside];
    [cell.contentView addSubview:boxView];
    FunBoxView * second = [[FunBoxView alloc]initWithFrame:CGRectMake(cell.frame.size.width * 2 / 3, 0.f, cell.frame.size.width / 3, height)];
    second.tag = HOMETAGBASE + 1;
    [second addTarget:self action:@selector(buttonClickedAction:) forControlEvents:UIControlEventTouchUpInside];

    [cell.contentView addSubview:second];

return cell;