Stop NSThread on iOS
问题 I have function call loop, but I want call it if my view appears, and not call it when the view disappears. Loop Function : -(void)updateArray { while (1) { NSLog(@"IN LOOP"); [NSThread sleepForTimeInterval:2.0]; if([FileSizeArray count] >0 || [FileCurrentSizeArray count] >0) { [FileSizeArray removeObjectsInRange:NSMakeRange(1, FileSizeArray.count-1)]; [FileCurrentSizeArray removeObjectsInRange:NSMakeRange(1, FileSizeArray.count-1)]; } [FileNameArray removeAllObjects]; [UserNameArray