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.
在我的主代码中(为了显示 UIActivityIndicatorView),我在后台线程上调用了一个函数 foo()。foo() 依次调用的函数会发生什么?这些函数也会在同一个后台线程中调用和执行吗?
是的,它也将在同一个后台线程中调用。
这实际上非常简单:您调用的所有内容都将与调用者在同一个线程中运行,除非您明确使用方法来创建新线程并在那里运行方法或导致方法在另一个线程中运行(例如performSelectorOnMainThread:withObject:waitUntilDone:)。但是从这些方法来看,它又是相同的:它们将与调用者在同一个线程中运行。
performSelectorOnMainThread:withObject:waitUntilDone: