0

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]; 
halfer
  • 19,824
  • 17
  • 99
  • 186
Warrior
  • 39,156
  • 44
  • 139
  • 214
  • Possible Duplicate of : [How to exit NSThread](http://stackoverflow.com/questions/909283/how-to-exit-nsthread) – raaz Feb 04 '11 at 13:01

1 Answers1

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

falconcreek
  • 4,170
  • 1
  • 21
  • 22