在我的应用程序中,我有一个“启用分页”的 ScrollView ,当我选择页面时, ImageView 以这种方式开始其动画
- (void) beginWinAnimation{
[UIView animateWithDuration:2.5
animations:^{successView.alpha = 1.0;}
completion:^(BOOL finished){
[UIView animateWithDuration:2.5
animations:^{successView.alpha = 0;}];
}];}
在此动画期间,我可以看到此 successView 下的 ScrollView ,并且可以移动 ScrollView 页面;我希望在动画过程中你不能移动 ScrollView ,但只能在动画完成时移动,这可能吗?
最佳答案
是的,这是可能的。当动画开始时设置[scrollView setScrollEnabled:NO];
动画完成后将其设置回YES
。
所以在你的代码中,它看起来像 -
- (void) beginWinAnimation{
[scrollView setScrollEnabled:NO];
[UIView animateWithDuration:2.5
animations:^{
successView.alpha = 1.0;
}
completion:^(BOOL finished){
[UIView animateWithDuration:2.5
animations:^{successView.alpha = 0;}
completion:^(BOOL finished){
[scrollView setScrollEnabled:YES];
}];
}];}
看看这是否有效。
关于IOS:在带有动画的 ImageView 下禁用 ScrollView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7874528/