ChenYilong / iOS11AdaptationTips

for iOS11 in [ObjC, Swift, English, 中文] {...} -- iOS11适配系列教程
MIT License
485 stars 47 forks source link

iOS 11 tableView for header in xib ! #3

Open HolmesZhao opened 7 years ago

HolmesZhao commented 7 years ago

Summary

使用 xib 创建 tableView 的 header 的时候出现缺少20的距离

How would you classify this issue?

Choose a problem area with iOS SDK:

Base Information for this issue

  1. iOS System Version:iOS 11 beta

  2. Language:

    • [x] Objective-C
    • [x] Swift
  3. Prototype(是否是真机)

    • [x] YES
    • [ ] NO
  4. Test devices:

    • [ ] iPhone 7

    • [ ] iPhone 7 Plus

    • [ ] iPhone SE, iPhone 5s

    • [x] iPhone 6s, iPhone 6

    • [x] iPhone 6s Plus, iPhone 6 Plus

    • [ ] iPad Pro (10.5-inch), iPad Pro (12.9-inch) (2nd generation)

    • [ ] iPad (9.7-inch), iPad mini 4, iPad Air 2, iPad mini 3

    • [ ] iPad Pro (9.7‑inch)

    • [ ] iPad Pro (12.9‑inch)

    • [ ] iPad Air, iPad mini 2

    • [ ] iPod touch (6th generation)

  5. What kind of issue are you reporting?

    • [x] Q-A
    • [ ] Crash
    • [x] Bug

What steps can we take to reproduce this issue?

Steps to Reproduce:

使用 xib 创建 tableView 的 header 的时候出现缺少20的距离, 如图: 白色区域就是添加的 header (白色区域就是添加的 header 明显上边少了20 point) 效果图 (效果图)

How to solve ?

Here is a Demo.

iOS_11Test.zip

Same questions on Stack OverFlow

no same questions

qimuya3 commented 7 years ago

降级到iOS10.3.2无法使用备忘录,播客等app。

relaxstis commented 7 years ago

我reveal看了一下,添加在控制器的View的第一层视图(如tableView或者scrollView),它的frame和bounds不一样,如(frame:0,0,w,h;bounds:0,-20,w,h),目前预备最简单粗暴方案是设置inset 将top设置为-20,再查看frame和bounds是一样的(0,0,w,h)。

relaxstis commented 7 years ago

This Problem is arises on iOS11

lovemo commented 7 years ago

interesting

yam-liu commented 7 years ago

try contentInsetAdjustmentBehavior

xhp281 commented 7 years ago

我也遇到了,我滑动 tableView 的时候改变headerView 的上面背景图片的 frame,但是顶部会有问题。

gregorpichler commented 7 years ago

Could someone please explain how this issue was solved?

samifei commented 7 years ago

This should answer your question http://www.jianshu.com/p/efbc8619d56b