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 8699755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:01:36+00:00 2026-06-13T02:01:36+00:00

I have an iPad App which uses a UISplitViewController as the root controller, I

  • 0

I have an iPad App which uses a UISplitViewController as the root controller, I have set up the delegate and I am using a UINavigationController for the DetailView and it seems to work normally.

I want the MasterViewContoller to always be hidden (on all rotations) when a particular viewcontroller is displayed in the DetailView Section. I can do this using the shouldHideViewController method on the UISplitViewController Delegate.

However if I do, then when I change the ViewController in the DetailView Section to another the MasterView is displayed but neither willHideViewController/willShowViewController is called in the delegate.

If I rotate the device and rotate back they are called and it works as expected, but they are not called until the device has been rotated and rotated back to the original orientation.

This causes the popover button to not be displayed on the first rotation after the MasterView has been displayed.

- (void)splitViewController:(UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController:(UIPopoverController*)pc {

// Keep references to the popover controller and the popover button, and tell the detail view controller to show the button.
barButtonItem.title = @"Survey Sections";
self.popoverController = pc;
self.rootPopoverButtonItem = barButtonItem;

UIViewController <SubstitutableDetailViewController> *detailViewController = [self.splitViewController.viewControllers objectAtIndex:1];

if ([detailViewController isKindOfClass:[UINavigationController class]]) {
    UINavigationController *detailNavController = (UINavigationController *)detailViewController;
    [[detailNavController.viewControllers objectAtIndex:0] showRootPopoverButtonItem:rootPopoverButtonItem];
}

}

- (void)splitViewController:(UISplitViewController*)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem {

// Nil out references to the popover controller and the popover button, and tell the detail view controller to hide the button.
UIViewController <SubstitutableDetailViewController> *detailViewController = [self.splitViewController.viewControllers objectAtIndex:1];

if ([detailViewController isKindOfClass:[UINavigationController class]]) {
    UINavigationController *detailNavController = (UINavigationController *)detailViewController;
    [[detailNavController.viewControllers objectAtIndex:0] invalidateRootPopoverButtonItem:rootPopoverButtonItem];
}

self.popoverController = nil;
self.rootPopoverButtonItem = nil;

}

- (BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation {

UIViewController *detailViewController = [svc.viewControllers objectAtIndex:1];

if ([detailViewController isMemberOfClass:[MySurveysViewController class]]) {
    return YES;
}else {

    if (UIInterfaceOrientationIsLandscape(orientation)) {
        return NO;
    }else {
        return YES;
    }

}

}

  • 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-13T02:01:37+00:00Added an answer on June 13, 2026 at 2:01 am

    I was having a very similar problem, using Apple’s sample code with the SubstitutableDetailViewController delegate combined with rotation.

    What I did was store a BOOL for when the orientation was landscape, updating it on willRotateToInterfaceOrientation with this code:

    isLandscape = UIInterfaceOrientationIsLandscape(self.interfaceOrientation);

    On viewWillAppear I checked whether the current orientation is landscape, and if it did not match the stored value, called this method:

    -(void)adjustLayoutForOrientation{
        if (isLandscape) {
            [self invalidateRootPopoverButtonItem:  self.navigationController.navigationItem.leftBarButtonItem];
    }else{
            LeftViewController *lvc = (LeftViewController *)[self.splitViewController delegate];
            [self showRootPopoverButtonItem:  lvc.rootPopoverButtonItem ];
        }
    }
    

    Obviously I am using the delegation code provided by Apple, but for completeness those methods are these and can be implemented easily:

    #pragma mark -
    #pragma mark Managing the popover
    
    - (void)showRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem {
        // Add the popover button to the left navigation item.
        [self.navigationController.navigationBar.topItem setLeftBarButtonItem:barButtonItem animated:NO];
    }
    
    
    - (void)invalidateRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem {
        // Remove the popover button.
        [self.navigationController.navigationBar.topItem setLeftBarButtonItem:nil animated:NO];
    }
    

    The master view controller (left side) is maintaining the reference to the rootPopoverButtonItem, which makes this work.

    EDIT: Note that I am also calling my adjustLayoutForOrientation method on viewDidLoad and willRotateToInterfaceOrientation… A better way might be to register with the Notification Center but I wasn’t sure if background/invisible view controllers would get these notifications…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ipad app which takes images from Photos application using ALAssetsLibrary and
I have an iPhone/iPad app which uses Core Data. In my DB I have
My iPad app uses a DetailView, which is embedded in a TabBarControl to switch
I have an app that uses NASA live TV stream for the iphone/ipad which
I have an iPad app which uses an open source class MMGridView. Basically I
I have a split view controller-based iPad app that uses a Web View to
I have an iPad app which has a funky Path-style menu which is present
I have a iPad app which is NOT modified for the new iPad with
I have an iPhone/iPad app which play a HTTP Live Stream of a tv
I have a basic iPhone/iPad app which has a ; a. List view &

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.