0

I followed this UIPopoverPresentationController on iPhone doesn't produce popover but doesn't produce popover on iphone. Here is the code of viewcontroller

class ViewController:UIViewController,UIPopoverPresentationControllerDelegate{

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

        if segue.identifier == "second"{

            let secondVC = segue.destination
            let controller : UIPopoverPresentationController = secondVC.popoverPresentationController!
            controller.delegate = self
        }
    }

    /* Popover delegate method */
    func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
        return UIModalPresentationStyle.none
    }
}

I am not able to show new viewcontroller using present as popover in iphone. (ios 10/xcode8)

After clicking on button secondViewController should popover on that button.

Community
  • 1
  • 1
Rakesh
  • 29
  • 6
  • this question is a little confusing: you say "doesn't produce popover on iphone" (i.e. the popover doesn't display), but you titled this as "delegate method not called". If it's the former (the popover doesn't display), can you show the code of how you (try to) bring up and display the popover? – Michael Dautermann Dec 31 '16 at 12:36
  • @MichaelDautermann I added screenshot of storyboard. – Rakesh Dec 31 '16 at 18:46

1 Answers1

1

After using this delegate method it is producing popover on iphone.

func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {

    return UIModalPresentationStyle.none
}
Rakesh
  • 29
  • 6