iOS 11 UITableView bug

后端 未结 2 1216
甜味超标
甜味超标 2021-01-31 19:51

The bug can be reproduced using the repo here.

I have a strange bug affecting my project in iOS 11 in my UITableView. The TableView in question is grouped, has expandabl

2条回答
  •  独厮守ぢ
    2021-01-31 20:04

    Try this workarround, assuming your IBOutlets and variables are not privates in StandardHeaderView.swift:

        func toggleSection(section: SectionType) {
        self.sectionsOpened[section] = !self.sectionsOpened[section]!
    
        let sectionIndex = self.sections.index(of: section)!
    
        let indexPath = IndexPath(row: 0, section: sectionIndex)
    
        UIView.animate(withDuration: 0.25) {
            self.tableView.reloadRows(at: [indexPath], with: .automatic)
            if let headerView = self.tableView.headerView(forSection: sectionIndex) as? StandardHeaderView {
                headerView.configWith(title: headerView.headerTitleLabel.text!, isOpen: self.sectionsOpened[section]!, selector: headerView.selector)
            }
    
            self.tableView.scrollToRow(at: IndexPath(row: 0, section: sectionIndex), at: .top, animated: true)
        }
    }
    

提交回复
热议问题