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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:05:11+00:00 2026-05-21T05:05:11+00:00

I get an orientation problem while using the following to code to display a

  • 0

I get an orientation problem while using the following to code to display a view on top of a split view.

[window addSubview:aSplitViewController.view];
[window insertSubview:aViewController.view aboveSubview:aSplitViewController.view];

the plain view has a couple of buttons and labels.

So the problem I am facing is that the first view opens in landscape mode but the labels and buttons on the view are in portrait mode.

UPDATE: Here is some code so if anyone wants to see more details…

In my App Delegate

- (void) makeSplitViewController {

NSMutableArray *controllers = [NSMutableArray arrayWithArray:tabBarController.viewControllers];

// First tabbbar item
// detail view
detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:nil];
UINavigationController *navDetailView = [[[UINavigationController alloc] initWithRootViewController:detailViewController] autorelease];
navDetailView.hidesBottomBarWhenPushed = YES;


// root view
rootViewController = [[RootViewController alloc] initWithStyle:UITableViewStylePlain];
rootViewController.detailViewController = detailViewController;
rootViewController.navigationItem.title = @"List";

UINavigationController *navRootView = [[[UINavigationController alloc] initWithRootViewController:rootViewController] autorelease];
navRootView.hidesBottomBarWhenPushed = YES;
navRootView.navigationBar.barStyle = UIBarStyleBlackTranslucent;

splitViewController = [[UISplitViewController alloc] init];
splitViewController.tabBarItem.title = @"Face Sheet";
splitViewController.tabBarItem.image = [UIImage imageNamed:@"gear1.png"];
splitViewController.navigationItem.title = @"Face Sheet";
splitViewController.viewControllers = [NSArray arrayWithObjects:navRootView, navDetailView, nil];
splitViewController.delegate = detailViewController;
splitViewController.hidesBottomBarWhenPushed = YES;
[controllers addObject:splitViewController];

// Second tabbbar item
scoreViewController = [[ScoreCardViewController alloc] initWithNibName:@"TableViewController" bundle:nil];
scoreViewController.tabBarItem.title = @"Score Card";
scoreViewController.tabBarItem.image = [UIImage imageNamed:@"gear1.png"];
scoreViewController.navigationItem.title = @"Score Card";
[controllers addObject:scoreViewController];

tabBarController.viewControllers = controllers;

}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

// Override point for customization after application launch.
// Create tabbar
tabBarController = [[UITabBarController alloc] init];
//tabBarController.delegate = self;

// Set window
[window addSubview:splashController.view];
[window insertSubview:tabBarController.view belowSubview:splashController.view];
[self.window makeKeyAndVisible];

application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;

return YES;

}

and here is the code in my SplashScreenView

- (IBAction) proceedButtonClick:(id)sender
 {
// Initialize loginpopview
PhysicianLoginViewController *loginViewController = [[PhysicianLoginViewController alloc] init];

popOverController = [[UIPopoverController alloc] initWithContentViewController:loginViewController];
popOverController.popoverContentSize = CGSizeMake(350, 200);
popOverController.delegate = self;

// Set a notification to dismiss it later
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginViewControllerDone:) name:@"loginViewControllerDone"  object:popOverController.contentViewController];

// Present popover
if ([popOverController isPopoverVisible])
{
    [popOverController dismissPopoverAnimated:YES];
}
else 
{

    [popOverController presentPopoverFromRect:CGRectMake(485, 600, 100, 100) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
}

}

 // Dismiss popview controller and setup the tabbar
- (void)loginViewControllerDone:(NSNotification *)notification{
  [[NSNotificationCenter defaultCenter] removeObserver:self];

// Button in content view controller was tapped, dismiss popover...
[self.popOverController dismissPopoverAnimated:YES];

// remove subview
[self.view removeFromSuperview];

// set tabbar
i3EAppDelegate *appDelegate = (i3EAppDelegate *) [[UIApplication sharedApplication]delegate];
[appDelegate makeSplitViewController];

}

It would be great if someone could point out where I am going wrong. I have been stuck with this problem for quite a few days and I have tried everything that comes to my mind…

  • 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-21T05:05:11+00:00Added an answer on May 21, 2026 at 5:05 am

    UIWindow has a subview that it uses for rotations and puts other views inside of that. You need to insert yourself into the root view (or something lower), not the window. Look at -[UIWindow rootViewController].

    UIView *rootView = [[[self window] rootViewController] view];
    [rootView addSubview:view];
    

    This will work as long as you’re using something with a root view controller. This will work as long as rootViewController isn’t nil. If you’re doing a raw “View Based” application, then it’s usually best to pick another view and add your view as its sibling rather than digging through the undocumented hierarchy:

    UIView *sibling = ... (some other view)
    [[sibling superview] addSubview:view];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following code. When i change orientation from portrait to landscape,
I'm trying to get the orientation (Roll, Pitch, Yaw) angles of the mobilePhone using
Here's the problem. I am using AVCaptureVideoDataOutput to get video frames from camera and
I have been working with the slider and am using the following code: $(function(){
I'm creating 3D Compass application. I'm using getOrientation method to get orientation (almost same
Is there a special method to get iPhones orientation? I don't need it in
I'm trying to get the size of my UIView after the orientation changes. In
I'm trying to get my app to change layouts when the orientation changes. This
I have following code: public class readSensorsData extends Activity implements SensorListener { /** Called
I'm developing an Android game that uses the orientation sensor to get the rotation

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.