ios - UIImagePickerController 推送 viewcontroller bug with allowsEditing

标签 ios

我正在尝试在用户选择图像后从 UIImagePickerController 推送 View Controller (用于额外编辑)。
推送成功。 但是当弹出该 View Controller 并且用户返回到编辑屏幕时,编辑屏幕不再可交互。有谁知道是什么问题。

    -(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];
        }

最佳答案

试试这个它在我的应用程序中工作:

   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];
        }

可能会有帮助。

关于ios - UIImagePickerController 推送 viewcontroller bug with allowsEditing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19584460/

相关文章:

ios - 用另一个 UIView 替换 UIView,保持约束

ios - XIB View 未显示正确的布局 [iOS Swift]

html - 链接在 iOS 设备上被忽略

ios - 在核心数据模型上创建通用包装器是一种不好的做法吗?

ios - addChildViewController 实际上做了什么?

android - Facebook 通知 - URL 上的代码参数是什么

ios - iphone 应用程序尺寸小于屏幕

objective-c - 多个可滚动 subview / TableView

ios - "CredStore - performQuery - Error copying matching cred."使用 AVPlayer 打开 Vimeo 时出错

ios - 按下 UIButton 后 Swift UILabel 以编程方式更新