0

我有一个循环,可以在每次迭代时创建更多 UI。这意味着我在这里几乎不能使用并发。整个序列阻塞了主线程很长时间,因为它很重。我想检测已完成的点击手势,以便在用户决定进入另一个菜单时取消长时间处理。我想要的是这样的:

while[...]:
  -Do a lot of UI-related operations
  -Force the main thread to handle gestures that were done 
   while the main thread was previously blocked
  -Continue to next iteration

在进行下一次迭代之前,我尝试使用NSRunLoop.RunUntil强制“清除”事件堆栈,但无济于事。无论如何,我读到这不是一个好习惯,因为 RunLoop 不是可重入的,即使我不确定这意味着什么。关于如何在此处进行的任何建议?

谢谢,

保罗

4

0 回答 0