1

I need to present a child UIViewController over a parent controller 90% to the top, allowing you to see the parent behind. Also, user must be able to swipe down the presented controller to dismiss. The parent is in a different storyboard.

Ive tried this, don't have a full working solution. Need to account for parentsNavigation bar and dragging child viewcontroller down.

[parent addChildViewController:child];
[child.view setFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
[parent.view addSubview:child.view];
[child didMoveToParentViewController:parent];

How can I achieve this UX? Thanks

AnonProgrammer
  • 239
  • 1
  • 11
  • did u try container view controller ? – Teja Nandamuri Dec 04 '18 at 02:29
  • @TejaNandamuri So add container with bounds below the parent. Then simply add new controller as child to container and animate up? – AnonProgrammer Dec 04 '18 at 02:38
  • yeah, that should work! – Teja Nandamuri Dec 04 '18 at 03:01
  • I added some code that could work without using container view. If I set the alpha to zero I can see the parent.. I think it should be straightforward sliding child viewcontroller down..My problem now is that the parent is a navigation controller so my view is pinned to the top of navigation bar. Even if I hide the navigation bar its just black at the top. – AnonProgrammer Dec 04 '18 at 03:16

0 Answers0