【发布时间】:2015-03-27 08:59:12
【问题描述】:
在 UIScrollView 使用 scrollToItemAtIndexPath 方法时,是否可以使用自定义动画?我想使用弹簧动画或自定义动画曲线。
【问题讨论】:
在 UIScrollView 使用 scrollToItemAtIndexPath 方法时,是否可以使用自定义动画?我想使用弹簧动画或自定义动画曲线。
【问题讨论】:
if let itemFrame: CGRect = collectionView.layoutAttributesForItemAtIndexPath(indexPath).frame {
//UIView animate block here
{
collectionView.scrollToItemIndexPath(indexPath, yourScrollPosition, false/*animated parameter*/)
/*or
collectionView.setContentOffset(corresponding content offset to itemFrame)*/
}
}
首先在 indexPath 访问该特定项目的帧,然后滚动到所需动画块内的该矩形。应该可以的。
【讨论】: