Viewforheaderinsection not called for last section in swift?

491 views Asked by At

Helll all,

I have added sections in the list.I have total 8 sections.Now on the last section i have a row on which i have added a button.On tap of button i open imagepicker.When i cancel the picker Viewwillappear is called & i reload the tableview.When i scroll down to last section to bottom & go imagepicker & come back then on table reload viewforheaderinsection is called.Now for section 6 & section 7 viewforheaderinsection is called but it is not getting called for section 8.Please tell me what is the issue with it.

Below is code for section 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

There are 0 answers