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.
在 NSThread 文档中,我遇到了方法detachNewThreadSelector:toTarget:withObject:。initWithTarget:selector:object:该方法与创建线程然后使用启动它有什么区别start?
detachNewThreadSelector:toTarget:withObject:
initWithTarget:selector:object:
start
唯一的区别是第二种方式为您提供了对 NSThread 对象的引用,因此您可以在启动它之前执行诸如设置堆栈大小或优先级之类的操作,或者稍后使用 isExecuting/Finished/Cancelled 方法检查其状态。