gpt4 book ai didi

ios - 将 Collection View 滚动到最后一个页脚 View

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:04:14 24 4
gpt4 key购买 nike

我知道我们可以使用以下方法将 Collection View 滚动到特定的单元格:

[self.collectionView scrollToItemAtIndexPath:indexPath atScrollPosition:UICollectionViewScrollPositionRight animated:NO];

在我的例子中,我想滚动到包含页脚 View 的 Collection View 的末尾。如果我使用上面的代码,那么 UICollectionView 会滚动到最后一个元素,但页脚 View 不可见。

最佳答案

找到这个答案 UIScrollView scroll to bottom programmatically ,它非常适合我的收藏 View (尽管对引用答案的争论仍在继续)。

CGPoint bottomOffset = CGPointMake(0, self.collectionView.contentSize.height - self.collectionView.bounds.size.height);
[self.collectionView setContentOffset:bottomOffset animated:YES];

关于ios - 将 Collection View 滚动到最后一个页脚 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16608893/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com