开发者

don't want to dismiss UIPopover

开发者 https://www.devze.com 2023-03-14 18:43 出处:网络
i am using this following code to display a popover in my View imagePopOver = [[UIPopoverController alloc];

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.


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

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

Don't forget to set the delegate!


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];

0

精彩评论

暂无评论...
验证码 换一张
取 消