komal mehta
komal mehta

Reputation: 269

How to prevent dismissing of the popover control?

I don't want to dismiss popover controller when i touch any view. Is it possible? I am using following code for displaying popover controller.

UIPopoverController* popoverCamera;

popoverCamera= [[UIPopoverController alloc] initWithContentViewController:videoRecorder];

[popoverCamera presentPopoverFromRect:CGRectMake(cropRectangleButton.frame.origin.x,cropRectangleButton.frame.origin.y,0,0) inView:innerview permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
NSLog(@"start recording-->%d",[videoRecorder startVideoCapture]);
[videoRecorder startVideoCapture];
[self presentModalViewController:videoRecorder animated:YES];  
[videoRecorder release];

Upvotes: 2

Views: 3743

Answers (5)

dbrownjave
dbrownjave

Reputation: 487

func popoverShouldClose(_ popover: NSPopover) -> Bool { return false }

Upvotes: 0

Nikhil Bansal
Nikhil Bansal

Reputation: 1545

Try this where you dont want to dismiss the popUp:-

[popOverController dismissPopoverAnimated:NO];

Hope this helps :)

Upvotes: -3

Ravi Kumar Karunanithi
Ravi Kumar Karunanithi

Reputation: 2218

From the Link disable dismissal of uipopoverview controller

When displayed, taps outside of the popover window cause the popover to be dismissed automatically. To allow the user to interact with the specified views and not dismiss the popover, you can assign one or more views to the passthroughViews property. Taps inside the popover window do not automatically cause the popover to be dismissed. Your view and view controller code must handle actions and events inside the popover explicitly and call the dismissPopoverAnimated: method as needed.

Upvotes: 1

Atulkumar V. Jain
Atulkumar V. Jain

Reputation: 5098

Yes it is possible. Implement the following delegate method:

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

Hope this might help you.

Upvotes: 4

vishy
vishy

Reputation: 3231

implement the pop over delegate

/* Called on the delegate when the popover controller will dismiss the popover. Return NO to prevent the dismissal of the view.
 */
- (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController;

Upvotes: 0

Related Questions