How to stop a NSThread in iphone? [duplicate]

筅森魡賤 提交于 2019-12-08 12:57:55

问题


Possible Duplicate:
How to exit NSThread

I have called a method using NSthread. I want to stop the thread on a click event of button. How can I achieve that?

[NSThread detachNewThreadSelector:@selector(playVideo) toTarget:self withObject:nil]; 

回答1:


Try the the documentation for Threading, or better yet use NSOperation to perform the playVideo maintain a reference to the operation in your viewController and send a cancel message to the operation. Refer to the documentationNSOperation documentation



来源:https://stackoverflow.com/questions/3152903/how-to-stop-a-nsthread-in-iphone

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!