Viewforheaderinsection没有在swift中调用最后一节?

时间:2017-09-02 13:30:02

标签: ios swift uitableview indexpath

全力以赴,

我在列表中添加了部分。我有8个部分。现在最后一部分我有一行我已经添加了一个按钮。点击按钮我打开imagepicker。当我取消选择器Viewwillappear被称为&我重新加载tableview。当我向下滚动到最后一部分到底部& go imagepicker&回来然后在表重新加载viewforheaderinsection被调用。现在第6节&第7节viewforheaderinsection被调用但第8节没有被调用。请告诉我它的问题是什么。

以下是第8节的代码。

   func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {

        if tableView == tableViewResult || section == 0 {
            let view = FieldsHeaderCell()
            view.frame = CGRect.zero
            return view
        }

        var view = FieldsHeaderCell()

        if section == 1 {
            view = UINib(nibName: "FieldHeaderWithoutDescription", bundle: nil).instantiate(withOwner: self, options: nil)[0] as! FieldsHeaderCell

        }  else {
            view = UINib(nibName: "FieldHeaderCell", bundle: nil).instantiate(withOwner: self, options: nil)[0] as! FieldsHeaderCell
            view.subTitleLabel.text = (cvManager.fields[section].title as! headerOfCV).subTitle
        }

        let progresLblText = Int(round((cvManager.fields[section].title as! headerOfCV).progressPercentage))

        let progress = CGFloat(((cvManager.fields[section].title as! headerOfCV).progressPercentage) * 360/100)

        self.progress(blockCompletionProgress: view.blockCompletionProgress, progressThickness: 0.7, trackThikness: 0.7, angle: Double(progress), profileProgress: false)

        view.blockCompletionProgress.angle = Double(progress)

        view.progrssLabel.text = String(format: "%d", progresLblText)
        view.titleLabel.text = (cvManager.fields[section].title as! headerOfCV).title

        if section == 7 {
            view.blockCompletionProgress.isHidden = true
            view.progrssLabel.isHidden = true
        }
        return view
    }

0 个答案:

没有答案