Vipin
Vipin

Reputation: 4728

don't want to dismiss UIPopover

i am using this following code to display a popover in my View

imagePopOver = [[UIPopoverController alloc];
initWithContentViewController:self.photoLibraryImageCollection.imagePickerController];
imagePopOver.popoverContentSize = CGSizeMake(185,675);
imagePopOver.delegate = self;   
[imagePopOver presentPopoverFromRect:CGRectMake(600,0, 140, 800) 
                              inView:self.view 
            permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];

it working fine however if we click any other part of myView ,this displayed popover is dismissing.can any one tell me how can i avoid this problem. i don't want to dismiss it at any time.can any one tell me how can do it.

Upvotes: 2

Views: 546

Answers (2)

Vipin
Vipin

Reputation: 4728

just wrote the below code at the time of popover initialization.

myPopOver.passthroughViews = [NSArray arrayWithObject:self.view];

in the above code will not dismiss your popOver and we can work with our View.

if you don't want to dismiss UIpopover only at the time of a textBox edit,simply write

myPopOver.passthroughViews = [NSArray arrayWithObject:self.textBox];

Upvotes: 1

fzwo
fzwo

Reputation: 9902

In the popover's delegate (your viewController, probably), implement

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

Don't forget to set the delegate!

Upvotes: 7

Related Questions