0

我需要为分组的 TableView 设置样式。我找到了这个教程:http ://www.raywenderlich.com/2033/core-graphics-101-lines-rectangles-and-gradients 。但不幸的是,简单版本(红色)对我不起作用。我正在使用 ARC,因此只有一行代码

cell.backgroundView = [[[CustomCellBackground alloc] init] autorelease]; cell.selectedBackgroundView = [[[CustomCellBackground alloc] init] autorelease];

不起作用。上面代码的 ARC 版本是什么。我在情节提要中使用原型单元。也许这就是它的原因。

4

1 回答 1

1

ARC 不使用autorelease,所以只需键入:

cell.backgroundView = [[CustomCellBackground alloc] init];
cell.selectedBackgroundView = [[CustomCellBackground alloc] init];
于 2013-04-09T17:17:01.943 回答