-1

Now my popover dismissing if i press anywhere on the screen, but i need to show and hide him only if i press the button(the same button), how can i do these? Thank you.

Roman Simenok
  • 530
  • 7
  • 22
  • 1
    What have you done so far? – Ashwin Krishnamurthy Oct 09 '13 at 22:27
  • @Ashwin Ganesh K, i try do write in my button smth like [Popover dismissPopoverAnimated:YES]; but it's useless, because if i tab a button, or better say try to tap, because in fact i can't press it, popover hides, and only after i can press my button. Sorry for my English) – Roman Simenok Oct 10 '13 at 11:13

1 Answers1

0

Just set a delegate to your UIPopoverController and implement the following method:

- (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController {
     return NO;
}

From the docs:

This method is called in response to user-initiated attempts to dismiss the popover. It is not called when you dismiss the popover using the dismissPopoverAnimated: method of the popover controller.

If you do not implement this method in your delegate, the default return value is assumed to be YES.

Community
  • 1
  • 1
Marcelo
  • 9,916
  • 3
  • 43
  • 52