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

banner不在window上的话pageControl会有问题 #18

Open
liyouleo911 opened this issue Aug 8, 2017 · 6 comments
Open

banner不在window上的话pageControl会有问题 #18

liyouleo911 opened this issue Aug 8, 2017 · 6 comments

Comments

@liyouleo911
Copy link

您好,我发现如果点击某一张banner弹出一个窗口遮住当前view controller的话,

  • (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath
    就不会被调用到了,但是collectionView还是在定时滚动的,这样当你回到banner所在的view controller时会出现page control和页面对不上的关系,要等自动滑倒下一张时才会修正过来。
@zzyspace
Copy link
Owner

zzyspace commented Aug 8, 2017

是否考虑当点击某一张 banner 的时候, 手动停止定时器, 返回的时候再开启定时器?

@zzyspace
Copy link
Owner

zzyspace commented Aug 8, 2017

后面可能考虑通过在 -scrollViewDidScroll: 中计算 scrollView 的 contentOffset 来做当前 item 的配置来计算 pageControl 的 currentPage

@liyouleo911
Copy link
Author

返回的时机不好判断啊

@zzyspace
Copy link
Owner

zzyspace commented Aug 9, 2017

- (void)banner:(ZYBannerView *)banner didSelectItemAtIndex:(NSInteger)index
{
    [banner stopTimer];
    UIView *newWindow = [[UIView alloc] init];
    newWindow.dismissBlock = ^{
        [banner startTimer];
    };
    [newWindow show];
}

类似这样的可以吗

@liyouleo911
Copy link
Author

这样需要在所有可能的newWindow上都添加dismissBlock这个callback,自己的代码还好办,如果是第三方库提供的页面就改不了了

@liyouleo911
Copy link
Author

另外还有一个问题就是,如果一个页面同时有多个bannerView存在,你只暂停了其中一个还是不够的

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