使 TableView 背景不可滚动

Make TableView background not scrollable

今天我遇到了另一个问题:我将背景图像添加到 table 视图中,我喜欢它在单元格滚动时保持静止。我找到了这个

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

此处iPhone Fixed-Position UITableView Background.

但是我无法"translate"从Objective-c到Swift...所以有人可以帮助我吗?

你可以尝试这样的事情。

var view = UIImageView(frame: /*whatever you want your frame to be*/)

view.image = //whatever you want your image to be

tableView.backgroundView = view