IOS:在带有动画的 ImageView 下禁用滚动视图
在我的应用程序中,我有一个“启用分页”的滚动视图,当我选择一个页面时,图像视图以这种方式开始其动画
- (void) beginWinAnimation{
[UIView animateWithDuration:2.5
animations:^{successView.alpha = 1.0;}
completion:^(BOOL finished){
[UIView animateWithDuration:2.5
animations:^{successView.alpha = 0;}];
}];}
。在此动画期间,我可以看到此 successView 下的滚动视图,并且可以移动滚动视图页面;我希望在动画过程中你不能移动滚动视图,但只能在动画完成时移动,这可能吗?
In my app, I have a scrollview with "paging enabled" and when I chose a page an imageview start its animation in this way
- (void) beginWinAnimation{
[UIView animateWithDuration:2.5
animations:^{successView.alpha = 1.0;}
completion:^(BOOL finished){
[UIView animateWithDuration:2.5
animations:^{successView.alpha = 0;}];
}];}
During this animation I can see the scrollview under this successView and I can move scrollview page; I want that during animation you can't move the scrollview but only when animation is finished, is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这是可能的。当动画开始时设置
[scrollView setScrollEnabled:NO];
动画完成后将其设置回YES
。所以在你的代码中,它看起来像 -
看看这是否有效。
Yes it's possible. When the animation starts set
[scrollView setScrollEnabled:NO];
After your animation is complete set it back toYES
.So in your code, it will look like -
See if this works.