iOS Present View Controller Within Popup

Viewed 14987

So I have my main view controller. That view controller has a bar button item with a storyboard segue with kind set as Present As Popover.

This all works as expected. But when you tap another button within that popover view controller it presents the view full screen. I want it to display within the popover. Like push/display on top of the existing popover bounds.

How can I achieve this?

I only want this behavior on iPad. But I think it does that by default.

Edit

I'd prefer to do this all in the storyboard but am willing to do it with Swift code as well if that is what's required.

3 Answers

Have you tried it - EzPopup (https://github.com/huynguyencong/EzPopup), a Swift pod. Just a few lines of code:

// init YourViewController
let contentVC = ...

// Init popup view controller with content is your content view controller
let popupVC = PopupViewController(contentController: contentVC, popupWidth: 100, popupHeight: 200)

// show it by call present(_ , animated:) method from a current UIViewController
present(popupVC, animated: true)
Related