swift - 使 TableView 背景不可滚动

标签 swift uitableview scroll background cell

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

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

在这里iPhone Fixed-Position UITableView Background .

但我无法将 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

关于swift - 使 TableView 背景不可滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31748107/

相关文章:

javascript - Scrollbottom js 在 Firefox、Chrome、Safari 中不起作用

SwiftyJSON API 请求返回 Null

json - 解析 JSON - Swift

ios - 在索引路径插入行问题

iphone - 进入编辑/重新排序模式时 UITableViewCell 自定义绘图和动画

python - 触摸屏滚动 Tkinter Python

javascript - 自定义按钮取代浏览器滚动——按住并连续滚动?

ios - 如何使用 Swift 从 ViewController 获取 TextView 的文本值?

swift - 如何在 Swift 中保存 PDF currentDestination

ios - cellForRowAtIndexPath : Is it XCode template correct?