UIImagePickerController推出视图控制器时允许编辑的Bug

5

当用户选择了一张图片后,我正在尝试从UIImagePickerController推出一个视图控制器(用于额外编辑)。
它成功地推出了。
但是,当该视图控制器被弹出并且用户返回到编辑屏幕时,编辑屏幕不再可交互。 是否有人知道问题在哪里?

    -(void)didTapBtn:(id)sender
        {
            self.picker = [[UIImagePickerController alloc] init];
            self.picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
            self.picker.delegate = self;
            self.picker.allowsEditing = YES;

            [self presentViewController:self.picker animated:YES completion:nil];
        }

        -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
        {
            UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];

            if (image == nil) {
                image = [info objectForKey:UIImagePickerControllerOriginalImage];
            }

            if (image == nil) {
                return;
            }



           self.test = [[BTTestViewController alloc] init];
            self.test.delegate = self;

            [self.picker pushViewController:self.test animated:YES];
        }

//Called by BTTestViewController
        -(void)didCancel
        {
            [self.picker popViewControllerAnimated:YES];
        }
1个回答

1

尝试这个,它在我的应用程序中有效:

   UIImagePickerController *imagePicker;//put it in .h file

 put it in .m file 
       imagePicker = [[UIImagePickerController alloc]init];
       imagePicker.delegate = self;

        if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
        {
             imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
             imagePicker.allowsEditing = YES;
              [self presentViewController:imagePicker animated:YES completion:nil];
        }
        else
        {
              UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"STEP-BY-STEP-STORY!" message: @"Camera is not available" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
              [alert show];

        }

     - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
         {
           UIImage *pickedImage = [info objectForKey:UIImagePickerControllerEditedImage];
           imageData.image =[self resizeImage:imageData.image width:200 height:200];
            [picker dismissViewControllerAnimated:YES completion:nil];

           iphone_filtersViewController *nav=[[iphone_filtersViewController alloc]initWithNibName:@"iphone_filtersViewController" bundle:nil];
           [self.navigationController pushViewController:nav animated:YES];

      }
      - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
      {
        // release Picker
         [picker dismissViewControllerAnimated:YES completion:nil];
      }

    // iphone_filtersViewController method
      -(IBAction)backButton
        {
           [self.navigationController popViewControllerAnimated:YES];
        }

也许它会有帮助。

我想要的是,当用户按下取消按钮时,它会返回到照片/相机屏幕。在您的方法中,选择器已经被解除了。所以这不是我想要的。 - wjh

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接