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

  • SEARCH
  • Home
  • 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 3630902
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:19:44+00:00 2026-05-19T00:19:44+00:00

I’ve been having a bit of trouble with a UISplitViewController in my iPad app.

  • 0

I’ve been having a bit of trouble with a UISplitViewController in my iPad app. I am attempting to make a simple navigation tree using the UINavigationController inside of the UISplitView. I have used the following basic code to do this:

NavController.h

@interface NavController : NSObject {
    /* 
     * This is connected properly to the UINavigationController in the 
     * UISplitViewController through Interface Builder.
     */

    UINavigationController *navigationController;

 }

 @property (nonatomic, retain) IBOutlet UINavigationController *navigationController;

 @end

NavController.m

#import "NavController.h"

@implementation NavController

@synthesize navigationController;

- (void) awakeFromNib {
    UIViewController *testController = [[UIViewController alloc] init];
    UITableView *tableView = [[UITableView alloc] init];

    [testController setView: tableView];

    [navigationController pushViewController: testViewController
                                    animated: YES];

}

@end

This code successfully pushes the view to the navigation controller, and I can navigate back with the back button, however, my problem arises with the fact that after this happens, my UISplitViewController no longer auto-rotates or rotates at all from the portrait position. When I remove this code (and the view does not get pushed) it works as expected.

What am I doing wrong, and am I going about this in the right way?

  • 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-05-19T00:19:44+00:00Added an answer on May 19, 2026 at 12:19 am

    This drove me absolutely nuts too. I did a couple of things that made it work, but I’m not happy about my solutions — 1) I don’t really understand it and 2) it seems hacky.

    I added this to my app delegate (my .m file):

    @interface UITabBarController (MyApp)
    @end
    
    @interface UINavigationController (MyApp)
    @end
    
    @implementation UITabBarController (MyApp) 
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
        return YES;
    }
    @end
    
    @implementation UINavigationController (MyApp) 
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
        return YES;
    }
    @end
    

    This worked for the most part. For the views that didn’t auto-rotate though, I had to manually rotate the views myself using transforms. I did something like:

    - (void)deviceOrientationDidChangeWithAnimation:(BOOL)animated {
        UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
    
        if (orientation == oldOrientation) {
            return;
        }
    
        if (animated) {
            CGFloat duration = [UIApplication sharedApplication].statusBarOrientationAnimationDuration;
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:duration];
            [UIView setAnimationDidStopSelector:@selector(orientationChanged)];
        }
    
        [self sizeToFitOrientation:YES];
    
        if (animated) {
            [UIView commitAnimations];
        }
    
        oldOrientation = orientation;
    }
    
    - (CGAffineTransform)transformForOrientation {
        UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
        if (orientation == UIInterfaceOrientationLandscapeLeft) {
            return CGAffineTransformMakeRotation(M_PI*1.5); // rotated CCW
        } else if (orientation == UIInterfaceOrientationLandscapeRight) { // CW
            return CGAffineTransformMakeRotation(M_PI/2);
        } else if (orientation == UIInterfaceOrientationPortraitUpsideDown) { // CCW
            return CGAffineTransformMakeRotation(-M_PI);
        } else { // CW
            return CGAffineTransformIdentity;
        }
    }
    
    - (void)sizeToFitOrientation:(BOOL)transform {
        if (transform) {
            self.view.transform = CGAffineTransformIdentity;
        }
    
        CGRect frame = [UIScreen mainScreen].applicationFrame;
        CGPoint center = CGPointMake(frame.origin.x + ceil(frame.size.width/2), frame.origin.y + ceil(frame.size.height/2));
    
        CGFloat width = frame.size.width - 0 * 2;
        CGFloat height = frame.size.height - 0 * 2;
    
        UIInterfaceOrientation _orientation = [UIApplication sharedApplication].statusBarOrientation;
        if (UIInterfaceOrientationIsLandscape(_orientation)) {
            self.view.frame = CGRectMake(0, 0, height, width);
        } else {
            self.view.frame = CGRectMake(0, 0, width, height);
        }
        self.view.center = center;
    
        if (transform) {
            self.view.transform = [self transformForOrientation];
        }
    }
    

    Hope this helps! And if someone can point out mistakes I’ve made (or bad things I’m perpetuating), I’d be happy to learn. 🙂

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I am using Paperclip to handle profile photo uploads in my app. They upload
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.