该bug可以使用回购这里再现。
我的UITableView中有一个奇怪的bug影响着我在UITableView 11中的项目。问题中的TableView是分组的,有可扩展的单元格。
我的iOS 10分支中没有出现许多奇怪的效果:
在苹果开发者论坛这里上,也有一张似乎相关的门票。
,我尝试了,但没有成功,
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.never
}
我试图在iOS 11中找到可能导致这个问题的行为。
任何帮助都将不胜感激!
编辑:裁剪到边界有帮助(但最终,它隐藏/剪辑了问题)。我仍然有一些问题(2,3和4)。当我试图打开一个单元时,它会传送回顶部,而不是顺利地运行。当我打开一个单元格并希望顺利地滚动到它时,它会传送到顶部,然后只滚动到它。(必须增加一节以显示)。
下面是这个问题的视频(使用iPhone 7 Plus,iOS 11,Xcode 9黄金母版):https://youtu.be/XfxcmmPdeoU
发布于 2017-09-26 21:41:43
在iOS 11中,所有估计的UITableView
属性(estimatedRowHeight
、estimatedSectionHeaderHeight
和estimatedSectionFooterHeight
)默认为UITableViewAutomaticDimension
。
我看到了,对于你的细胞来说,这很好,因为你要返回UITableViewAutomaticDimension
in heightForRow
。然而,对于您的节头和页脚,您没有使用自动调整大小的方法。我将尝试通过将estimatedSectionHeaderHeight
和estimatedSectionFooterHeight
设置为0
来禁用页眉/页脚中的所有自动调整大小行为。
发布于 2017-10-20 15:01:48
假设您的IBOutlets和变量在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)
}
}
https://stackoverflow.com/questions/46223541
复制相似问题