UI not responding when popover is presented

151 views Asked by At

I have 2 buttons say button1 and button2. A popover will be presented when we tap on button1. When popover is presented, if we tap on button2, it does not respond to tap action instead popover will be dismissed. What i need is, When we tap on button2, I need to dismiss pop over and button2's action also should be performed. How i can get this simultaneously. Please give me some suggestions. Thanks in advance.

1

There are 1 answers

0
Naga Mallesh Maddali On

As per default behaviour of the UIPopoverController, it will be dismissed when user taps outside of the popover. Following is the notes from Apple documentations :

The UIPopoverController class is used to manage the presentation of content in a popover. You use popovers to present information temporarily. The popover content is layered on top of your existing content and the background is dimmed automatically. The popover remains visible until the user taps outside of the popover window or you explicitly dismiss it. Popover controllers are for use exclusively on iPad devices. Attempting to create one on other devices results in an exception.

If you want to perform any action when you want to tap on button 2, easiest way is to move the Button 2 on top of the popover content. That way you can explicitly dismiss popover when user taps on Button 2 and also perform your custom action there itself.