所有单元格的 UITableView 背景图像

UITableView background image for all cells

我想更改我的 tableview 背景图片。当我更改它时,更改不会影响单元格。我正在为我的单元格使用 xib,它里面没有任何代码,只是设计。那么我该如何解决呢?

    self.list.backgroundView = [[UIImageView alloc] initWithImage:
                            [UIImage imageNamed:@"Pattern.png"]];

在您的 cellForRowAtIndexPath 方法中,将单元格的背景颜色设置为透明色。它将使您的单元格透明并显示背景图像。

Objective C:

cell.backgroundColor = [UIColor clearColor];

Swift:

cell.backgroundColor = UIColor.clearColor()