【问题标题】:How make UITableView transparent如何让 UITableView 透明
【发布时间】:2016-08-09 06:58:52
【问题描述】:

我正在尝试几种这样的解决方案来使我的 UITableView 透明

    func tableView(tableView: UITableView, cellForRowAtIndexPath        indexPath: NSIndexPath) -> UITableViewCell {
      tableView.backgroundColor=UIColor.clearColor()
    let cell = tableView.dequeueReusableCellWithIdentifier("signCell", forIndexPath: indexPath) as! SignUpTableViewCell


    cell.backgroundColor=UIColor.clearColor()
    cell.signInfo.text="Mee"

   return cell
}

我也让我的文字透明,但之后的表格和文字消失了。

【问题讨论】:

  • tableView.backgroundColor=UIColor.clearColor()
  • @Anbu.Karthik 我想要快速解决方案
  • @Chirag Patel 这就是我要做的,表格和文字消失了我只想让表格透明

标签: ios uitableview uitextfield


【解决方案1】:

在 ViewDidLoad 中试试这个代码

_tableView.backgroundColor = UIColor.clearColor()

【讨论】:

    【解决方案2】:

    在某些情况下,设置 tableView.backgroundColor 不起作用,tableView 的背景总是白色的。我在自定义 UIView 中使用 UITableView 时遇到了这个问题,并解决了这个问题:

    public func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {        
        tableView.backgroundColor = UIColor.clear
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多