priore

How to manage the image asynchronously from a UIImagePicker

Jun 10th, 2013
579
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // How to manage the image asynchronously from a UIImagePickerController
  2. - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
  3. {
  4.         // hide UIImagePickerController
  5.         [picker dismissViewControllerAnimated:YES completion:^{
  6.             dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_current_queue(), ^{
  7.                 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
  8.                     UIImage *originalImage = [info objectForKey:UIImagePickerControllerOriginalImage];
  9.            
  10.                     if (photo) {
  11.                    
  12.                         // TODO: you code here....
  13.                     }
  14.                 });
  15.             });                                  
  16.         }];
  17. }
RAW Paste Data