Why is there extra padding at the top of my UITableView with style UITableViewStyleGrouped in iOS7

前端 未结 30 3141
隐瞒了意图╮
隐瞒了意图╮ 2020-11-22 12:47

Starting in iOS7, there is additional space at the top of my UITableView\'s which have a style UITableViewStyleGrouped.

Here is an example:<

30条回答
  •  甜味超标
    2020-11-22 13:12

    According to this transition guide for iOS7 by Apple, the scroll view’s content insets is automatically adjusted. The default value of automaticallyAdjustsScrollViewInsets is set to YES.

    The UIViewController which has the UITableView should set this property to NO.

    self.automaticallyAdjustsScrollViewInsets = NO;
    

    This will do the trick.

    EDIT 1:

    Also, one could try -

    self.navigationController.navigationBar.translucent = YES;
    

    This also removes the extra padding on the top.

提交回复
热议问题