方法-tableView中自定义UITableViewCell:cellForRowAtIndexPath:仅在单元格离开屏幕后可见

时间:2012-02-23 10:55:44

标签: ios uitableview

我有一个非常简单的单元格自定义.. 我只是想用自定义的图像视图替换它的附件视图,但只有当单元格从屏幕滚动后再次可见时,它才能正确显示我的自定义。

虽然当我用我的自定义图像视图替换单元格的附件视图属性时它立即起作用。但我不喜欢它,因为由于某些原因我无法操纵细胞附件视图的背景颜色。

更新:

以下是我的例子:

顺便说一下,我在我的数据源中使用了三个20的表项(TTTableTextItem)作为单个项目, 我想稍微修改它的细胞外观,所以我在这里试了一下:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [super tableView cellForRowAtIndexPath:indexPath];

    if([cell isKindOfClass:([MYCell class])]) {
        UIImageView *iv = 
        [[[UIImageView alloc] initWithFrame:
         CGRectMake(cell.contentView.right-kPadding,
                    kPadding, 
                    kCustomAccessorSize,
                    kCustomAccessorSize)] 
         autorelease]
        // Then Setting the Image and add as subview in contentView
    }
    return cell;
  }

0 个答案:

没有答案