How to make Thread paused or stopped when view dispear i do that:
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:(BOOL)animated];
[NSThread sleepForTimeInterval:10];
}
but didnt work
How to make Thread paused or stopped when view dispear i do that:
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:(BOOL)animated];
[NSThread sleepForTimeInterval:10];
}
but didnt work
You should do this in viewWillDisappear
but more likely you probably shouldn't do this.
You should never sleep for longer than a few milliseconds in the UI thread. If you do the OS will kill your application, in addition to it behaving poorly.
Do you button disable instead of NSThread sleep
[yourBtn setEnabled:NO];
When you retrieve complete data then enable it
[yourBtn setEnabled:YES]