目标 C:滚动视图问题

发布于 2025-01-07 06:33:51 字数 846 浏览 3 评论 0原文

我在滚动视图中有一个滚动视图。

当滚动视图结束减速时,母滚动视图有动画并且工作正常,但是当我开始滚动内部滚动视图时,它会重复母滚动视图的动画。

我计划在子滚动视图结束减速时为其添加其他功能。

这是我的母滚动视图代码的一部分

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
    CGFloat pageWidth = 768;
    page = floor((self->motherScrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;

    if (page == 2)
    {
        //animationOnEnter
    }
    else if (page == 3)
    {
        //animationOnEnter
    }
    else if (page == 4)
    {
        //animationOnEnter
    }
    else if (page == 5)
    {
        //animationOnEnter
    }
    else if (page == 6)
    {
        //animatiOnEnter
    }
    else if (page == 7)
    {
        //animationOnEnter
    }
    else if (page == 8)
    {
        //animationOnEnter
    }

//由于这个问题,我还没有为子滚动视图编写任何代码。

有人吗?提前致谢 :)

i have a scrollview inside a scrollview.

the mother scrollview has animations when the scrollview end decelerating and it working fine but when i started to scroll the inner scrollview it repeats the animations of the mother scrollview.

i am planning to put other function for the child scrollview when it ends decelerating.

here's the part of my code for the mother scrollView

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
    CGFloat pageWidth = 768;
    page = floor((self->motherScrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;

    if (page == 2)
    {
        //animationOnEnter
    }
    else if (page == 3)
    {
        //animationOnEnter
    }
    else if (page == 4)
    {
        //animationOnEnter
    }
    else if (page == 5)
    {
        //animationOnEnter
    }
    else if (page == 6)
    {
        //animatiOnEnter
    }
    else if (page == 7)
    {
        //animationOnEnter
    }
    else if (page == 8)
    {
        //animationOnEnter
    }

//i haven't coded yet anything for the child scrollview because of this issue.

anyone? Thanks in advance :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

漆黑的白昼 2025-01-14 06:33:51
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
    CGFloat pageWidth = 768;
    if ([scrollView isEqual:motherScrollView]) {
     page = floor((self->motherScrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
.....
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
    CGFloat pageWidth = 768;
    if ([scrollView isEqual:motherScrollView]) {
     page = floor((self->motherScrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
.....
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文