2013-10-25 1 views
5

ユーザーがイメージを選択した後で、UIImagePickerControllerからビューコントローラ(追加編集用)をプッシュしようとしています。
正常に押されました。 しかし、そのビューコントローラがポップされ、ユーザーが編集画面に戻ると、編集画面はもはや対話できなくなります。誰が問題であるか知っていますか?UIImagePickerControllerは、ビューコントロールのバグをletsEditingで返します。

-(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

それは私のアプリケーションでは動作し、このいずれかを試してみてください。

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

は、それが役立つかもしれません。

+0

私が欲しいのは、ユーザーがキャンセルを押すと、写真/カメラの画面に戻ります。あなたの方法では、ピッカーはすでに却下されています。これは私が望むものではありません。 – wjheng

関連する問題