【发布时间】:2015-05-07 09:55:17
【问题描述】:
希望你们一切都好。 我的申请中有一个小问题。我有一个带有自定义单元格的表格视图。在我的自定义单元类中,我制作了一个 uiview
UIView* cellView = [[UIView alloc] initWithFrame:self.contentView.frame];
cellView.backgroundColor = [UIColor grayColor];
[self.contentView addSubview:cellView];
- (SummaryViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"cell";
SummaryViewCell *cell = (SummaryViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if(cell == nil)
{
cell = [[SummaryViewCell alloc] init];
}
cell.backgroundColor = [UIColor blueColor];
return cell;
}
我尝试过 initWithFrame:self.contentView.frame] 但同样的问题发生了(uiview 出现在单元格中但只覆盖了一半的单元格),我也尝试过 cellView = [[UIView alloc] initWithFrame:CGRectMake(0,0 ,self.frame.size.width 和高度相同)但失败了。需要您的宝贵建议和想法。非常感谢。
【问题讨论】: