Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8011025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:54:35+00:00 2026-06-04T18:54:35+00:00

This is basically in continuation of: Dismissing iPad UIPopoverController when BarButtonItem is pushed while

  • 0

This is basically in continuation of: Dismissing iPad UIPopoverController when BarButtonItem is pushed while it’s open, however I see the issue as large enough that it warranted another question.

Basically, they wanted to show the popover when the barbuttonitem (provided by the splitviewcontroller) is clicked, and then hide the popover when the same barbuttonitem is clicked again. They solved it by calling:

- (void)splitViewController:(UISplitViewController*)svc popoverController:(UIPopoverController*)pc willPresentViewController:(UIViewController *)aViewController{
    if ([popoverController isPopoverVisible]) {
        [popoverController dismissPopoverAnimated:YES];
    }
}

However, I’ve come to the problem where on the first click of the barbuttonitem, this method is called correctly and it displays the popover. However, on any subsequent clicks of the barbuttonitem while the popover is open, this method is not called.

More puzzling, when I close the popover view through other means (clicking outside of the popover), then the popover closes automatically. However, a click on the button itself does not close the popover, nor does it call that “willPresentViewController” method.

Are there other means of catching this button click action? Or any thoughts on why the method is not called on a click of the button while the popover is open?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T18:54:37+00:00Added an answer on June 4, 2026 at 6:54 pm

    So it seems a normal UISplitViewController automatically closes when you click the “master” button a second time, however, I’m using an MGSplitViewController. So I modified MGSplitViewController.m (specifically showMasterPopover:) to handle dismissing itself when the button it clicked a second time as follows:

    -(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];
        }
        else if(_hiddenPopoverController && _hiddenPopoverController.popoverVisible)
        {
            [_hiddenPopoverController dismissPopoverAnimated:YES];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is basically a continuation from my previous question . Seeing that my fixed
I am trying to to build a Felix bundle in Eclipse. This basically includes
This is basically what I am trying to do. I wanna take a File
This code basically translates characters based on position in one string to the character
This is basically a math problem, but very programing related: if I have 1
This is basically a duplicate of this question , but the accepted answer was
This is basically the same question as Click items in select box, and then
This is basically a 'best practices' question. Struts 1 forms have getters and setters
This is basically a rails 3 version of this question . Short of parsing
basically this is my question: How to query MongoDB with "like"? but i guess

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.