在UIActivityIndi​​catorView旋转时禁用所有输入

mic*_*ica 24 cocoa-touch uiactivityindicatorview ios

如何在UIActivityIndicatorView旋转时禁用所有输入?

谢谢

Rok*_*arc 52

您可以beginIgnoringInteractionEvents在启动微调器时调用

[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
Run Code Online (Sandbox Code Playgroud)

endIgnoringInteractionEvents当你停止它.

[[UIApplication sharedApplication] endIgnoringInteractionEvents];
Run Code Online (Sandbox Code Playgroud)

只需确保您的代码始终到达您调用的位置endIgnoringInteractionEvents,否则您的应用程序将冻结(从用户的角度来看).

  • 谢谢那帮助!! (2认同)

小智 6

在Swift 3.0中:

要禁用互动:

UIApplication.shared.beginIgnoringInteractionEvents() 
Run Code Online (Sandbox Code Playgroud)

要恢复互动:

UIApplication.shared.endIgnoringInteractionEvents() 
Run Code Online (Sandbox Code Playgroud)