【问题标题】:UICollectionView scroll-to-top animation not working properlyUICollectionView 滚动到顶部动画无法正常工作
【发布时间】:2015-10-23 09:10:20
【问题描述】:

我正在使用此代码将我的 UICollectionView 滚动到顶部:

CGPointMake(0, -self.collectionView.contentInset.top) animated:YES];

它做了它应该做的事情,但问题是单元格在滚动过程中消失(或者更好的是,在动画完成之前不会加载/显示滚动开始位置上方的单元格)。有没有办法解决这个问题?

我也想知道有没有办法知道这个动画什么时候结束?

谢谢。

【问题讨论】:

  • 使用这个? [self.tableView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];
  • 感谢您的回答,但它的作用相同。未显示单元格。
  • 我不知道为什么,但在动画期间我的单元格视图仍然出现,尽管它只有 0.5 秒左右

标签: ios objective-c animation scrollview collectionview


【解决方案1】:

我认为您应该尝试使用此方法滚动到顶部:

- (void)scrollToItemAtIndexPath:(NSIndexPath *)indexPath 
               atScrollPosition:(UICollectionViewScrollPosition)scrollPosition 
                       animated:(BOOL)animated

【讨论】:

    猜你喜欢
    • 2012-03-03
    • 1970-01-01
    • 1970-01-01
    • 2019-01-27
    • 1970-01-01
    • 2015-09-05
    • 1970-01-01
    • 2018-11-02
    • 1970-01-01
    相关资源
    最近更新 更多