我有一个带有自定义表格单元格的 TableView。我以编程方式在每个单元格的底部添加边框以保持屏幕设计布局。一切都很好,当应用程序第一次加载时。但是在滚动(并滚动回顶部)后,屏幕上会显示多条边框线。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{ static NSString *CellIdentifier = @"CellProgramm";
ProgrammTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
...
if([object.cellMessageArray[1] isEqualToString:@"wrapper"] || [object.cellMessageArray[1] isEqualToString:@"keynote"] || [object.cellMessageArray[1] isEqualToString:@"break"]) {
UIImageView *lineSeparator = [[UIImageView alloc] initWithFrame:CGRectMake(0, cell.bounds.size.height, 1024, 5)];
lineSeparator.image = [UIImage imageNamed:[NSString stringWithFormat:@"blind.png" ]];
lineSeparator.backgroundColor = [UIColor whiteColor];
[cell.contentView addSubview:lineSeparator];
}
else if([object.cellMessageArray[1] isEqualToString:@"standard"]) {
UIImageView *lineSeparator = [[UIImageView alloc] initWithFrame:CGRectMake(60, cell.bounds.size.height+4, 1024, 1)];
lineSeparator.image = [UIImage imageNamed:[NSString stringWithFormat:@"blind.png" ]];
lineSeparator.backgroundColor = [UIColor pxColorWithHexValue:@"eeeeee"];
[cell.contentView addSubview:lineSeparator];
}
}
有人有想法吗?