chinthakad
chinthakad

Reputation: 979

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.

Upvotes: 4

Views: 1937

Answers (1)

Zev Eisenberg
Zev Eisenberg

Reputation: 8158

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.

Upvotes: 6

Related Questions