cómo mostrar una alerta cuando el usuario haga clic en el botón de uso después de tomar una imagen utilizando uiimagepicker?

StackOverflow https://stackoverflow.com/questions/1832459

Pregunta

Quiero mostrar una alerta cuando el usuario dispara una imagen y haga clic en el uso extraño que en el iPhone OS 2.0 cuando disparamos una imagen que muestra un mensaje de carga de button.It, pero en el iPhone OS 3.0 no muestra nada. ¿Cómo puedo mostrar una alerta también hay una manera de acelerar el proceso imagepicking? en mi aplicación a veces es lento ya veces es rápido no he resolver esto yet.Does alguien sabe al respecto?

¿Fue útil?

Solución

En el método de "imagePickerController" vas a querer mostrar un UIAlertView. A continuación se muestra el método completo con la creación de UIAlertView.

El UIAlertView será visto por la cantidad de tiempo que se tarda en guardar la imagen en el álbum de fotos.

También tendrá que añadir el método "didFinishSavingWithError"

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)selectedImage editingInfo:(NSDictionary *)editingInfo
{
  if(picker.sourceType == UIImagePickerControllerSourceTypeCamera)
  {
    saveImage = [[UIAlertView alloc] initWithTitle:@"Saving Image..." message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:nil]; 

    UIActivityIndicatorView *waitView = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge] autorelease];
    waitView.frame = CGRectMake(120, 50, 40, 40);
    [waitView startAnimating];

    [saveImage addSubview:waitView];
    [saveImage show]; 
    [saveImage release];

    UIImageWriteToSavedPhotosAlbum(selectedImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
  }

  [self dismissModalViewControllerAnimated:YES];
}

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
  // Was there an error?
  if (error == NULL)
   {
     NSLog(@"Image Saved");
     [saveImage dismissWithClickedButtonIndex:0 animated:YES]; 
   }
  else
   {
     // Error occured
   }
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top