Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

切换 imageURLStringsGroup 索引有问题 #734

Open
MuRanJiangXia opened this issue Aug 22, 2024 · 1 comment
Open

切换 imageURLStringsGroup 索引有问题 #734

MuRanJiangXia opened this issue Aug 22, 2024 · 1 comment

Comments

@MuRanJiangXia
Copy link

切换数据源会显示错乱,比如先设置有两个元素的数组 ,然后切换成一个元素的数组,再次切换两个元素的数组,索引偶尔会变成1而不是0

  • (void)setImagePathsGroup:(NSArray *)imagePathsGroup
    {
    [self invalidateTimer];

    _imagePathsGroup = imagePathsGroup;

    _totalItemsCount = self.infiniteLoop ? self.imagePathsGroup.count * 100 : self.imagePathsGroup.count;

    if (imagePathsGroup.count > 1) { // 由于 !=1 包含count == 0等情况
    self.mainView.scrollEnabled = YES;
    [self setAutoScroll:self.autoScroll];
    } else {
    self.mainView.scrollEnabled = NO;
    [self invalidateTimer];
    }
    // 修改了 [self.mainView setContentOffset:CGPointMake(0, 0) animated:NO];
    [self setupPageControl];
    [self.mainView reloadData];
    }

    // 修改了 [self.mainView setContentOffset:CGPointMake(0, 0) animated:NO];
    加上这个能规避一下

@chinaiOSSwift
Copy link

chinaiOSSwift commented Aug 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants