-1

In my application i have used the following code to implement after dismissing the view i have pushed to new view,When i tried to implement the view is not dismissing instead it overlapping.Here my code,

-(IBAction)selectExitingPicture
 {
if([UIImagePickerController isSourceTypeAvailable:
    UIImagePickerControllerSourceTypePhotoLibrary])
   {
    UIImagePickerController *picker= [[UIImagePickerController alloc]init];
    picker.delegate = self;
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentViewController:picker animated:YES completion:nil];
   }
 }
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image
             editingInfo:(NSDictionary *)editingInfo
 {
    [picker dismissViewControllerAnimated:YES completion:^{
    cropingImageViewCon = [[CropingImageViewControl alloc]initWithNibName:@"CropingImageView" bundle:nil];
    cropingImageViewCon.delegate = self;
    cropingImageViewCon.originalImg = image;
    [self.navigationController presentModalViewController:cropingImageViewCon animated:YES];
    }];
  }

Whats wrong with my code,Can any one please help out.

Globas techn
  • 95
  • 1
  • 6
  • How did you present the picker in the first place? – Mike Pollard May 16 '13 at 08:56
  • @MikePollard i have update the quest code.Please check – Globas techn May 16 '13 at 08:58
  • What view are you expecting should be dismissing? Looking at the code, the imagepicker view should be dismissing, after that the cropingImageViewCon view should be presented modally over the view that has the control that calls selectExitingPicture – Marcel May 16 '13 at 09:13
  • Do you want to push into CropingImageViewControl after dismissing ImagePicker? – Yuvrajsinh May 16 '13 at 09:46
  • @Marcel when i do that it shows `Attempt to present on whose view is not in the window hierarchy!` – Globas techn May 16 '13 at 09:53
  • Thats tells you that the controller (which has the control that's calling selectExitingPicture), is not the UINavigationController's rootViewController. The UINavigationController is not part of the window hierarchy at all. – Marcel May 16 '13 at 10:00

1 Answers1

0

If you want to push into CropingImageViewControl then you are going wrong way,

Use

[self.navigationController pushViewController:yourViewCotrollerObject animated:YES];

instead of using presentModalViewController:

Yuvrajsinh
  • 4,536
  • 1
  • 18
  • 32