UICollectionView with ContentInset is not Scrolling all the Way Down

后端 未结 6 1644
长发绾君心
长发绾君心 2020-12-29 06:20

I am setting the content inset of a UICollectionView:

[_collectionView setContentInset:UIEdgeInsetsMake(0.f, 0.f, 100.f, 0.f)];

Then I am s

6条回答
  •  轮回少年
    2020-12-29 07:19

    Today, by chance I discovered the solution!

    Select your view controller and uncheck the option "Adjust Scroll View Insets".

    enter image description here

    With this option unchecked, iOS does not automatically adjust your insets of the view (and probably its subviews), which caused the problems for me ... Uncheck it and configure your scroll insets like this programmatically:

    - (void)configureInsetsOfCollectionView
    {
        [_collectionView setContentInset: UIEdgeInsetsMake(self.navigationController.navigationBar.bounds.size.height + [UIApplication sharedApplication].statusBarFrame.size.height + DEFAULT_SPACING, 0.f, _keyboardHeight + _toolbar.bounds.size.height + DEFAULT_SPACING, 0.f)];
        [_collectionView setScrollIndicatorInsets:UIEdgeInsetsMake(self.navigationController.navigationBar.bounds.size.height + [UIApplication sharedApplication].statusBarFrame.size.height, 0.f, _keyboardHeight + _toolbar.bounds.size.height, 0.f)];
    }
    

提交回复
热议问题