我正在尝试创建一个 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/