如何检查线程是否仍在运行?

| 我想在viewDidLoad中检查线程是否正在运行, 我如何实现这样的概念?     
已邀请:
是的你可以。
NSThread
具有确定线程状态的方法
isExecuting
isCancelled
isFinished 
您可以使用这些方法。 例如在viewDidLoad中,您可以编写
BOOL stillRunning = [[NSThread currentThread] isExecuting];
升级:
[NSThread currentThread]
将返回当前的运行线程。 static0ѭ类的静态方法。 为你自己的线程
BOOL isStillRunning = [yourThreadObject isExecuting];
    

要回复问题请先登录注册