Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interact with other views while a popover is active

I have a toolBar and I have setup two UIBarButtonItem on it. Both UIBarButtonItem are containing UIButtons as their customViews.

I activate a popover for their Touch Up Inside event as below,

    [popover1 presentPopoverFromBarButtonItem:buttonItem1 permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

I have another UIButton named clearFilters inside the main view. (Also this is the view which is containing the above toolBar.) I have declared a method for clearFilters button's Touch Up Inside event.

My problem is, I can not interact with the clearFilters button while a popover is active. So, I'm looking for a solution to interact with this clearFilters button, while a popover is active.

I tried by adding passthroughViews property for a popover as below and it do not work as I expect.

popover1.passthroughViews = [NSArray arrayWithObject:clearFiltersButton];

What could be the reason. As the documentation has mentioned I can not see any issue.

I expect if the above things are correct, then the Touch Up Inside event of the the clearFilters button's should be fire up.

So, please show me if there is any issue or a necessary way to work on this thing.

I'm working on XCode4 and iOS 4.3.

Thanks.

like image 603
chinthakad Avatar asked Oct 22 '25 07:10

chinthakad


1 Answers

The UIPopoverController documentation reveals why the other bar buttons can be tapped while the popover is visible:

“When presenting the popover, this method adds the toolbar that owns the button to the popover’s list of passthrough views.”

Try querying and logging the popover’s passthrough views. Does it already have things in it? Perhaps something like this would work?

myPopover.passthroughViews = [myPopover.passthroughViews arrayByAddingObject:clearFilters];

I haven’t tested this code, but it’s worth a try.

like image 101
Zev Eisenberg Avatar answered Oct 23 '25 21:10

Zev Eisenberg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!