【问题标题】:The text of the uitableviewcell comes under section viewuitableviewcell 的文本位于剖面视图下
【发布时间】:2016-10-15 07:49:03
【问题描述】:

我遇到了这样的问题。文本我的单元格在表格部分下爬行,成为谷歌但找不到解决方案。在做这些事情之前,当我只是 UITableViewController 没有额外的元素如段。一切都很完美。告诉我如何解决这个问题。谢谢!

func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
        let cell = tableView.dequeueReusableHeaderFooterViewWithIdentifier("CommonSectionTableView") as! CommonSectionTableView
        cell.titleLabel.text = self.ordersSectionName[section]
        return cell
}


func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
    return 55.0
}

【问题讨论】:

    标签: ios swift uitableview


    【解决方案1】:

    试试这个代码....

      //If you want to place a header
      let header = "Your Header Name"
      func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
        return header 
    }
    
    //If you using section header
     override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
    return "Section \(Your Section Name or Array)"
    }
    

    上面的代码会将 headerView 放在 tableView 的上方...

    如果您想自定义您的 headerView 结帐以下问题

    How can we add image in UITableView section header using swift?
    Customize UITableView header section
    http://www.ioscreator.com/tutorials/customizing-header-footer-table-view-ios8-swift

    【讨论】:

    • 你能上传另一个覆盖整个屏幕的屏幕截图吗?你看链接了吗?你得到的输出是一样的还是有什么变化?
    猜你喜欢
    • 2018-05-14
    • 1970-01-01
    • 2013-04-20
    • 1970-01-01
    • 2021-11-16
    • 1970-01-01
    • 1970-01-01
    • 2010-11-23
    • 1970-01-01
    相关资源
    最近更新 更多