繁体   English   中英

UIImagePickerController使用allowsEditing推送viewcontroller错误

[英]UIImagePickerController push viewcontroller bug with allowsEditing

我试图在用户选择图像后从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];
        }

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

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

可能会有所帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM