gpt4 book ai didi

iphone - 自定义绘制UITableViewCell

转载 作者:行者123 更新时间:2023-12-03 19:29:14 25 4
gpt4 key购买 nike

我正在尝试创建一个 UITableViewCell 来覆盖内容的完整绘制。我已经重写了正在调用的drawRect,但它仍然绘制默认内容。

如何让它停止绘制默认内容以及如何用我自己的渲染替换它?

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

DLog (@"Overloaded TableCell initWithStyle");
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {

}
return self;
}

- (void)drawRect:(CGRect)rect {
DLog (@"TableCell::drawRect");

// expecting it to draw nothing
}

最佳答案

Loren Brichter(Tweetie 的作者)在一次 iTunes U 斯坦福 iPhone 编程类(class)讲座中谈到了这一点。他说,通过子类化 UITableViewCell 并直接绘制每个单元格的内容,他获得了很好的滚动性能结果,他在 his blog post on the subject 中给出了一个代码示例。 .

他还指出,苹果已添加 a similar example在他们的代码示例之一中。

关于iphone - 自定义绘制UITableViewCell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1106658/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com