iOS 11 UITableView错误 [英] iOS 11 UITableView bug

查看:94
本文介绍了iOS 11 UITableView错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以使用repo

解决方案

在iOS 11中,所有估计的 UITableView 属性( estimatedRowHeight estimatedSectionHeaderHeight estimatedSectionFooterHeight )默认为 UITableViewAutomaticDimension



我看到你的单元格正常,因为你要返回 UITableViewAutomaticDimension heightForRow 中。对于您的部分页眉和页脚,但您没有使用自动调整大小。我会尝试通过将 estimatedSectionHeaderHeight estimatedSectionFooterHeight 设置为<$来禁用页眉/页脚中的所有自动调整大小行为c $ c> 0 。



来源: iOS 11浮动TableView标题


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 expandable cells.

Many weird effects happen that are not appearing on my iOS 10 branch:

  1. Titles superposes
  2. weird teleport issues when content size is above the UITableView container size when the collapsing of the cells occur
  3. Weird teleport to top of tableview at the beginning of the scrolling when content size exceeds the container's size
  4. Cell sizing is wrong (quite often)

There is also a ticket that seems related on the Apple Developers forum here.

I tried without any success:

if #available(iOS 11.0, *) {
    tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.never
}

I am trying to find the behavior that changed in iOS 11 that could cause this issue.

Any help would be appreciated!

edit: Clipping to bounds helped (but in the end, it hides/clips the problem). I still have a few issues (2, 3 and 4). When I try to unwrap a cell it teleports back to the top instead of going smoothly. When I unwrap a cell and want to scroll to it to it smoothly, it teleports to top then only scrolls to it. (had to add an additional section to show).

Here is a video of the issue (using iPhone 7 Plus, iOS 11, Xcode 9 Golden Master): https://youtu.be/XfxcmmPdeoU

解决方案

In iOS 11, all the estimated UITableView properties (estimatedRowHeight, estimatedSectionHeaderHeight, and estimatedSectionFooterHeight) default to UITableViewAutomaticDimension.

I see that for your cells that's fine as you're returning UITableViewAutomaticDimension in heightForRow. For your section headers and footers however you aren't utilizing the auto-sizing. I would try disabling all the auto-sizing behavior in your headers/footers by setting estimatedSectionHeaderHeight, and estimatedSectionFooterHeight to 0.

Source: iOS 11 Floating TableView Header

这篇关于iOS 11 UITableView错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆