【问题标题】:Change the Background Color for the footer in section更改部分页脚的背景颜色
【发布时间】:2017-11-10 17:32:33
【问题描述】:

我想更改剖面视图中页脚的背景颜色。 将背景颜色设置为白色。

我尝试了以下程序,但没有一个成功。

  1. 在viewDidLoad()中添加代码

    let HEADER_HEIGHT = 100
    tableView.tableHeaderView?.frame.size = CGSize(width:
    tableView.frame.width, height: CGFloat(HEADER_HEIGHT)).
    
  2. view.contentView.backgroundColor = UIColor.white in willDisplayHeaderView()

  3. 更改了 xib 文件的颜色

  4. heightForFooterInSection

    override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
        if section > 1 {
            return 10
        }
        return 0
    }
    

请就这个问题向我提供意见。

【问题讨论】:

  • 能否在section方法中为footer添加view的完整代码?
  • 在你的图片中,节页脚是什么部分?
  • 灰色空间是页脚
  • rajtharan-g - override func tableView(_ tableView: UITableView, willDisplayFooterView view: UIView, forSection section: Int) { } 该方法已弃用。您是否推断此方法
  • 这是UITableViewController 还是添加了表格视图的UIViewController?表格视图是否填满屏幕?你在实现viewForFooterInSection 方法吗?

标签: ios swift uitableview


【解决方案1】:

主要问题是滚动标题 所以,我已经改为普通组。有额外的灰色空间。 我想删除灰色空间。

现在我再次更改为 Group to Plain。修复额外的灰色空间。 修复滚动标题。 我在 viewDidLoad() 中添加了以下行 self.automaticallyAdjustsScrollViewInsets = false

【讨论】:

    猜你喜欢
    • 2011-11-29
    • 2019-03-20
    • 2012-12-02
    • 1970-01-01
    • 1970-01-01
    • 2021-05-09
    • 1970-01-01
    • 2013-09-15
    • 1970-01-01
    相关资源
    最近更新 更多