gpt4 book ai didi

uicollectionview - 禁用 UICollectionView 的焦点触发滚动

转载 作者:行者123 更新时间:2023-12-04 16:08:07 35 4
gpt4 key购买 nike

有没有办法禁用 UICollectionView 的自动滚动细胞何时聚焦?当单元格进入焦点时,我想手动调整单元格的内容偏移量。

我不想更新内容偏移量:

- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context
withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
{
[coordinator addCoordinatedAnimations:^
{
[UIView animateWithDuration:[UIView inheritedAnimationDuration]
animations:^
{
// Move next focused cell.
if ([context.nextFocusedView isKindOfClass:[YBZEventCollectionViewCell class]])
{
UICollectionViewCell *cell = (UICollectionViewCell *)context.nextFocusedView;

CGPoint offset = CGPointMake(CGRectGetMinX(cell.frame), 0.0f);

[_collectionView setContentOffset:offset];
}
}];

} completion:nil];
}

这是有效的,但由于焦点引擎也会移动我的单元格(滚动它),我最终得到了不流畅的动画,在它的末尾有一个“踢”。

最佳答案

刚刚遇到了这个确切的事情。禁用 UICollectionView 的自动滚动当焦点更改时,只需在界面构建器中的集合 View 的“ ScrollView ”属性中禁用滚动:

enter image description here

关于uicollectionview - 禁用 UICollectionView 的焦点触发滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33523819/

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