Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide popover when the barbuttonitem is pressed and the popver is already visible #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions Classes/MGSplitViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -704,16 +704,21 @@ - (IBAction)toggleMasterView:(id)sender

- (IBAction)showMasterPopover:(id)sender
{
if (_hiddenPopoverController && !(_hiddenPopoverController.popoverVisible)) {
// Inform delegate.
if (_delegate && [_delegate respondsToSelector:@selector(splitViewController:popoverController:willPresentViewController:)]) {
[(NSObject <MGSplitViewControllerDelegate> *)_delegate splitViewController:self
popoverController:_hiddenPopoverController
willPresentViewController:self.masterViewController];
}

// Show popover.
[_hiddenPopoverController presentPopoverFromBarButtonItem:_barButtonItem permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
if (_hiddenPopoverController) {
if (_hiddenPopoverController.popoverVisible) {
// Hide popover.
[_hiddenPopoverController dismissPopoverAnimated:YES];
} else {
// Inform delegate.
if (_delegate && [_delegate respondsToSelector:@selector(splitViewController:popoverController:willPresentViewController:)]) {
[(NSObject <MGSplitViewControllerDelegate> *)_delegate splitViewController:self
popoverController:_hiddenPopoverController
willPresentViewController:self.masterViewController];
}

// Show popover.
[_hiddenPopoverController presentPopoverFromBarButtonItem:_barButtonItem permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
}
}

Expand Down