iPhone13 CollectionView issue

When I use UICollectionView on iPhone13 and the latest devices, [collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:section] atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:YES] will cause caton. animated:YES has no animation effect, but this method works well on other devices, They are IOS 15.0.2 systems

- (void)topClick:(UIButton *)sender{

   

    if (sender.selected) {

        return;

    }

    

    NSArray *array = [NSArray array];

    if (sender == self.topLuck) {

        array = self.luckList;

    } else if (sender == self.topLuxurious){

        array = self.luxuriousList;

    } else if (sender == self.topVip){

        array = self.vipList;

    } else if (sender == self.topPk){

        array = self.pkList;

    } else if (sender == self.packetBtn){

        array = self.packetList;

    }

    NSInteger section = [self.datas indexOfObject:array];

//    [self didScrollToSection:section];

    

    if (section < self.datas.count) {

        [self.giftCollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:section] atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:YES];

    }

}

- (UICollectionView *)giftCollectionView{

    if (!_giftCollectionView) {

        LiveGiftPickerLayout *layout = [LiveGiftPickerLayout new];

        layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;

        layout.sectionInset = UIEdgeInsetsMake(0, 10, 0, 10);

        CGFloat width = floor((kScreen_Width - 20)/4);

        layout.itemSize = CGSizeMake(width, width);

        layout.minimumLineSpacing = 0;

        layout.minimumInteritemSpacing = 0;

        _giftCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];

        _giftCollectionView.dataSource = self;

        _giftCollectionView.delegate = self;

        _giftCollectionView.backgroundColor = [UIColor clearColor];

        _giftCollectionView.showsHorizontalScrollIndicator = NO;

        _giftCollectionView.pagingEnabled = YES;

        [_giftCollectionView registerClass:[GiftPickerCollectionViewCell class] forCellWithReuseIdentifier:[GiftPickerCollectionViewCell currentIdentifier]];

    }

    return _giftCollectionView;

}

will cause caton

What do you mean ?

Could you show the code, that will help understand a potential problem.

Please note also that the title of the thread should be a synthetic description of the problem, not the full text of the post.

collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:section] atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:YES] will cause jamming

Same problem. I use a collectionview and a timer to become an autoplaying banner. When there two banners appear in a view and scroll automatically with a short time lag, the [collectionview scrollToItemAtIndexPath:atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally:animated:YES] method has no animation but flashes to the next item, sometimes one banner also stops at a wrong position, which I found appeared on iPhone 13 pro, but not appeared on 12 pro,xr,8,etc.

iPhone13 CollectionView issue
 
 
Q