假设有一个UIView
作为容器,里面包含一个UIActivityIndicatorView
和其他 subview 。当UIActivityIndicatorView
动画时,它设置userInteractionEnabled
属性设置为 NO,这使得它的所有兄弟 View 都停止接收输入事件。
我查看了Apple的文档,它建议我们可以使用UIViewAnimationOptionAllowUserInteraction
常量来解决这个问题。但我不知道在哪里或哪个属性设置这个常量。有没有人遇到过这个问题并解决是吗?
UIViewAnimationOptionAllowUserInteraction
是使用 block 动画 View 的选项之一。允许用户在动画制作时与 View 进行交互。
enum {
UIViewAnimationOptionLayoutSubviews = 1 << 0,
UIViewAnimationOptionAllowUserInteraction = 1 << 1,
UIViewAnimationOptionBeginFromCurrentState = 1 << 2,
UIViewAnimationOptionRepeat = 1 << 3,
UIViewAnimationOptionAutoreverse = 1 << 4,
UIViewAnimationOptionOverrideInheritedDuration = 1 << 5,
UIViewAnimationOptionOverrideInheritedCurve = 1 << 6,
UIViewAnimationOptionAllowAnimatedContent = 1 << 7,
UIViewAnimationOptionShowHideTransitionViews = 1 << 8,
UIViewAnimationOptionCurveEaseInOut = 0 << 16,
UIViewAnimationOptionCurveEaseIn = 1 << 16,
UIViewAnimationOptionCurveEaseOut = 2 << 16,
UIViewAnimationOptionCurveLinear = 3 << 16,
UIViewAnimationOptionTransitionNone = 0 << 20,
UIViewAnimationOptionTransitionFlipFromLeft = 1 << 20,
UIViewAnimationOptionTransitionFlipFromRight = 2 << 20,
UIViewAnimationOptionTransitionCurlUp = 3 << 20,
UIViewAnimationOptionTransitionCurlDown = 4 << 20,
UIViewAnimationOptionTransitionCrossDissolve = 5 << 20,
UIViewAnimationOptionTransitionFlipFromTop = 6 << 20,
UIViewAnimationOptionTransitionFlipFromBottom = 7 << 20,
};
typedef NSUInteger UIViewAnimationOptions;
但我不知道它对您使用 UIActivityIndicatorView 有何帮助。简单例子:
[UIView animateWithDuration:0.4f
delay:0.2f
options:UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionCurveEaseInOut
animations:^{
[myView setFrame:CGRectOffset(view.frame, 0, -100)];
}
completion:^(BOOL finished){
NSLog(@"completed");
}
];
关于ios - 关于 iOS 中的 UIActivityIndicatorView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7912436/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |