0

I'd like to be able to dismiss my modals by sliding them down. To do, I'd like to be able to see the previous view controller behind the current one as I drag it down.

To do so, I encapsulated my view in a scroll view and I tried to print an image of the previous VC behind so as I slide down I can see it. Unfortunately it does work, all I can see is a black screen.

I used this code to do this:

UIGraphicsBeginImageContext(self.view.bounds.size);

[self.navigationController.viewControllers[ self.navigationController.viewControllers.count-1].view.layer renderInContext:UIGraphicsGetCurrentContext()];

UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

self.view.backgroundColor = [UIColor colorWithPatternImage:viewImage];

Does anyone has an idea on how to do this?

Thanks a lot

apxcode
  • 7,696
  • 7
  • 30
  • 41
Spearfisher
  • 8,445
  • 19
  • 70
  • 124

1 Answers1

0

you can add the "above" view controller this way:

[self.scrollview addsubview:secondVC.view];

and sure u have to decrease the opacity of the view to see through

Moataz Hossam
  • 413
  • 7
  • 20