내 코드 :NSOperationQueue cancelAllOperations이 작동하지 않을 때 viewWillDisappear
NSOperationQueue *queue;
-(void)viewDidLoad
{
queue = [NSOperationQueue new];
NSOperation* loadImgOp = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(refresh) object:nil];
[queue addOperation:loadImgOp];
}
-(void)refresh
{
[self operationFirst];
[self operationSecond];
...
[self operationFive];
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
});
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[queue cancelAllOperations];
}
나는 새의 ViewController 전화, 다음 - (무효) 새로 고침 작업을 계속합니다. cancelAllOperations가 작동하지 않습니다.
"cancelAllOperations does not working"정확히 무엇을보고 있습니까? –
이 메서드를 죽이고 싶습니다. - (void) refresh,이 ViewController를 종료 할 때 (새로운 ViewController를 호출 할 때). – runia