我想,当用户拍摄的图片显示一个警告,点击使用button.It的奇怪的是,在iPhone OS 2.0,当我们拍摄的照片可见其装载的消息,但在iPhone OS 3.0也说明不了什么。 如何显示一个警告也有办法来固定imagepicking过程?在我的应用程序有时是缓慢,有时它的快,我还没有想出解决办法yet.Does有人知道呢?

有帮助吗?

解决方案

在你的方法“imagePickerController”你会想显示一个UIAlertView中。下图就是与创造UIAlertView中的完整方法。

在UIAlertView中将被显示的时间长度,它需要将图像保存到相册。

您还需要添加方法“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
   }
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top