This question already has an answer here:
这个问题已经有了答案:
- Check whether or not the current thread is the main thread 11 answers
- 检查当前线程是否为主线程11
How to determine if the current thread inside a method is a main thread, or just a thread that is asynchronous and created? Does the ID tell me?
如何确定方法中的当前线程是主线程,还是异步创建的线程?身份证告诉我了吗?
1 个解决方案
#1
120
Like this: [NSThread isMainThread]
这样的:[NSThread isMainThread]
#1
120
Like this: [NSThread isMainThread]
这样的:[NSThread isMainThread]