I want to stop calling loop function when View disapear. How can i do that? This is my code:
-(void) viewWillAppear:(BOOL)animated
{
[self performSelectorInBackground:@selector(updateArray) withObject:nil];
}
And :
-(void)updateArray
{
while (1)
{
NSLog(@"IN LOOP");
[NSThread sleepForTimeInterval:2.0];
....}
updateArray is callled usually when this View disappear. I want to stop call updateArray function
Thanks in advance