0

I have select the Popoverviewcontroller segue in storyboard for IPad over UIBarbutton to view controller. When i select one time on the add button it displays the Popoverviewcontroller, I want to dismiss the popover when the Popoverviewcontroller screen is present and user click the add button again.

It is working if user tab outside the Popoverviewcontroller but it not working with the UIButton which is connected with segue to popover view controller.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
URathore
  • 3
  • 4

1 Answers1

2

In your prepareForSegue method you need to assign your popoverController and set its delegate so you can access it. Then you can access that popoverController from your viewController and dismiss the popover with your action method.

Create a popoverController property and assign it from your prepareForSegue

_poController = ((UIStoryboardPopoverSegue*)segue).popoverController;
_poController.delegate = self;

In your action method.

[_poController dismissPopoverAnimated:YES];
LJ Wilson
  • 14,445
  • 5
  • 38
  • 62
Mark McCorkle
  • 9,349
  • 2
  • 32
  • 42
  • Extracted to a universal app-compatible category [available here](https://gist.github.com/30b50baa954ec395227b) –  Jul 17 '14 at 03:51