Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在不使用睡眠的情况下阻止 UI 线程?
只是要明确一点:我知道用户界面会冻结用户,但这就是想法。
我可以运行空的 RunLoops 吗?任何其他方式。
如果您只想阻止与 UI 的所有交互,请调用UIApplication方法-beginIgnoringInteractionEvents。如果您实际上试图阻止整个 UI 执行任何操作(这不是一个好主意,例如,您的应用程序可能会阻止系统通知的出现),那么是的,NSRunLoop这可能是正确的方法。
UIApplication
-beginIgnoringInteractionEvents
NSRunLoop