【问题标题】:How to avoid to see background behind tableView Swift如何避免在 tableView Swift 后面看到背景
【发布时间】:2016-03-10 17:26:26
【问题描述】:

我在我的 tableView 中向下滚动时遇到以下问题。 我想避免看到 tableView 后面的白色背景。

我该如何解决?谢谢

【问题讨论】:

  • 将表格视图背景颜色设置为您想要的颜色。或为表格视图设置背景图像。
  • 您只需将高度设置为与 UI 中的视图高度相同,因此它不会显示背景为白色
  • 你想看什么背景
  • 我已经按照 Teja Nandamuri 的说法设置了背景颜色。谢谢

标签: ios iphone swift uitableview


【解决方案1】:

看起来您已使用 Grouped tableview,然后尝试将 TableView StyleGrouped 更改为 Plain

【讨论】:

    【解决方案2】:

    我想你想让单元格透明,在你加载表格的地方添加这个函数。

    func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath)
    {
        cell.backgroundColor = UIColor(white: 1, alpha: 0.0)
    }
    

    before这变成了after

    【讨论】:

    • 为什么使用UIColor(white: 1, alpha: 0.0) 而不是UIColor.clearColor()?只是好奇。
    • 我用来给出不同强度的alpha
    猜你喜欢
    • 2019-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-24
    • 2020-04-19
    • 1970-01-01
    相关资源
    最近更新 更多