Objective C: UIScrollView (pagingEnabled): 当下一页进入时开始动画

编程入门 行业动态 更新时间:2024-10-07 11:22:56
本文介绍了Objective C: UIScrollView (pagingEnabled): 当下一页进入时开始动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

对不起,我不知道在那里写什么.

I'm sorry for the title i don't know what to write there.

我有一个包含许多页面的滚动视图,并且在每个页面中都有不同的动画,当用户切换到该页面时应该开始.

I have a scrollView with many pages and in each page there are different animations that should start when the user switch to that page.

我试过这个:

if (CGPointEqualToPoint (CGPointZero, CGPointZero))
{
    //start animation
}

它只对第一页有效

当我将其更改为下一页的 CGPointEqualToPoint (CGPointMake (768, 0), CGPointZero) 时,它不起作用.

when i changed it to CGPointEqualToPoint (CGPointMake (768, 0), CGPointZero) for the next page, it's not working.

我正在尝试使用这个`

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset

但后来我发现当滚动视图 pagingEnabledYES 时它不起作用.

but then i found out that it is not working when the scrollview pagingEnabled is YES.

推荐答案

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView

通过使用滚动视图的这种委托方法,您可以在第一页完成滚动时获得,并且通过保持条件可以开始动画.

by using this delegate method of scroll view you can get when your first page finish scrolling and by keeping conditions you can start animation.

这篇关于Objective C: UIScrollView (pagingEnabled): 当下一页进入时开始动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-29 01:46:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1182571.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:动画   Objective   UIScrollView   pagingEnabled

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!