카메라로 사진을 선택하면 NSData
으로 저장됩니다. 이 작업은 오래 걸리고 사용자가 기다리는 것을 원하지 않습니다. 나는 그것이 배경에서 일어나길 원한다. 제 질문은 "dismissModalViewControllerAnimated:NO
"이라고 부른 후에 방법을 수행하는 것이 현명한 방법인지 여부입니다.dismissModalViewControllerAnimated 후의 액션
DEBUG1
debug2
debug4
debug5
debug6
debug3
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// Access the uncropped image from info dictionary
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
NSLog(@"debug1");
// Save image in the normal photo album
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
NSLog(@"debug2");
[[MySingleton sharedSingleton] addImg:image];
NSLog(@"debug3");
[picker dismissModalViewControllerAnimated:NO];
[_delegate startStep2];
}
-(void) addImg: (UIImage *) img {
NSLog(@"debug4");
NSData *jpegData = UIImageJPEGRepresentation([img rotateAndScaleFromCameraWithMaxSize:1500.0], 0.9f);
NSLog(@"debug5");
image = [[NSData alloc] initWithData:jpegData];
NSLog(@"debug6");
}
내가의 ViewController 첫째을 닫고보다 수 :
이
다음과 같은 출력 내 코드입니다 다른 것들, 아니면 좋은 방법이 아닌가요?[[MySingleton sharedSingleton] performSelectorInBackground:@selector(addImg:) withObject:image];