ios - 为什么我的 UITableView 的顶部有额外的填充,在 iOS7 中具有 UITableViewStyleGrouped 样式

标签 ios uitableview ios7

从 iOS7 开始,我的 UITableView 的顶部有额外的空间,其样式为 UITableViewStyleGrouped

这是一个例子:

enter image description here

表格 View 从第一个箭头开始,有 35 个像素的无法解释的填充,然后绿色标题是 viewForHeaderInSection 返回的 UIView(其中 section 为 0) .

谁能解释这 35 像素的数量是从哪里来的,以及我如何在不切换到 UITableViewStylePlain 的情况下摆脱它?


更新(答案):

在 iOS 11 及更高版本中:

tableView.contentInsetAdjustmentBehavior = .never

最佳答案

我得到以下帮助:

YouStoryboard.storyboard > YouViewController > Attributes inspector > Uncheck - Adjust scroll view insets.

enter image description here

关于ios - 为什么我的 UITableView 的顶部有额外的填充,在 iOS7 中具有 UITableViewStyleGrouped 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18880341/

相关文章:

iphone - QLPreviewController NavigationBar setTranslucent 属性不起作用

javascript - 如何在iOS自动化脚本中搜索字符串中的子字符串? indexOf() 和 search() 方法不起作用

ios - 在 Swift 中使用未解析的标识符 'SignUp'

ios - 在给定时间捕获 AVPlayer 流 .m3u8 的 UIImage 帧?

iphone - UIWebView 不会加载新的 URL

ios - 在运行时更改标签节点文本。 .

ios - 获取位置后如何进行后台网络调用?

objective-c - 将 UITableViewController 关联到 UITableView

ios - swift 线程 1 : EXC_BAD_INSTRUCTION when I try to change a uilabel. 文本

ios - 带有@property 的简单类示例不允许属性检索