I have called a method using NSthread. I want to stop the thread on a click event of button. How can i achieve that ?Please help me out.Thanks.
[NSThread detachNewThreadSelector:@selector(playVideo) toTarget:self withObject:nil];
I have called a method using NSthread. I want to stop the thread on a click event of button. How can i achieve that ?Please help me out.Thanks.
[NSThread detachNewThreadSelector:@selector(playVideo) toTarget:self withObject:nil];
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