Swift 3 how to open a Popover so that it does not cover all viewcontroller that called it?

Asked

Viewed 65 times

0

I already use the Popover that is opened through a "follow" and I would like you to define the dimensions (height and width) of this Popover so that it does not completely cover the viewcontroller that opened it. I use the following instructions in viewcontroller:

performSegue(withIdentifier: "callDriverPopupSegue", sender: self)


override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier == "callDriverPopSegue" {
        let popOver = segue.destination as! CallDriverPopup
        popOver.modalPresentationStyle = .popover
        popOver.popoverPresentationController!.delegate = self
    }
}

And in Popover included the Uipopoverpresentationcontrollerdelegate:

class CallDriverPopup: UIViewController, UIPopoverPresentationControllerDelegate 

1 answer

0

Behold here an explanation of Apple, in English but great

Here is also an example of how to set size.

> let height = yourDataArray.count *
> Int(popOverViewController.tableView.rowHeight)
> popOverViewController.preferredContentSize = CGSize(width: 300,
> height: height)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.