【问题标题】:Make TableView background not scrollable使 TableView 背景不可滚动
【发布时间】:2015-07-31 22:13:56
【问题描述】:

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

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

这里iPhone Fixed-Position UITableView Background

但我无法从 Objective-c 到 Swift 的“翻译”...所以有人可以帮我吗?

【问题讨论】:

    标签: swift uitableview scroll background cell


    【解决方案1】:

    你可以试试这样的。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-15
      • 1970-01-01
      • 2020-10-31
      相关资源
      最近更新 更多