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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:22:15+00:00 2026-05-24T08:22:15+00:00

In my custom Tab Bar Application, the orientation never seems to change, even if

  • 0

In my custom Tab Bar Application, the orientation never seems to change, even if I force rotate the status bar. Here is my code in my AppDelegate:

AppDelegate.h:

    #import <UIKit/UIKit.h>
    #import "MBProgressHUD.h"

    @class exampleViewContoller;
    @class example1ViewController;
    @class example2ViewController;
    @class example3ViewController;
    @class example4ViewController;

    @interface <appname>AppDelegate : NSObject <UIApplicationDelegate, MBProgressHUDDelegate> {
        UIWindow *window;
        UITabBarController *rootController;
        exampleViewContoller *viewController;
        example1ViewController *viewController1;
        example2ViewController *viewController2;
        example3ViewController *viewController3;
        example4ViewController *viewController4;
        NSMutableData *responseData;
        NSMutableArray *tweets;
        MBProgressHUD *HUD;
    }

    @property (nonatomic, retain) IBOutlet UIWindow *window;
    @property (nonatomic, retain) IBOutlet UITabBarController *rootController;
    @property (nonatomic, retain) IBOutlet exampleViewContoller *viewController;
    @property (nonatomic, retain) IBOutlet example1ViewController *viewController1;
    @property (nonatomic, retain) IBOutlet example2ViewController *viewController2;
    @property (nonatomic, retain) IBOutlet example3ViewController *viewController3;
    @property (nonatomic, retain) IBOutlet example4ViewController *viewController4;
    @property (nonatomic, retain) NSMutableArray *tweets;

    @end

AppDelegate.m:

    #import "<appname>AppDelegate.h"
    #import "exampleViewContoller.h"
    #import "example1ViewController.h"
    #import "example2ViewController.h"
    #import "example3ViewController.h"
    #import "example4ViewController.h"
    #import "SBJson.h"
    #define TMP NSTemporaryDirectory()

    @implementation <appname>AppDelegate

    @synthesize window = _window;
    @synthesize rootController;
    @synthesize viewController;
    @synthesize viewController1;
    @synthesize viewController2;
    @synthesize viewController3;
    @synthesize viewController4;
    @synthesize tweets;

    #pragma mark -
    #pragma mark Application lifecycle

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        CGFloat width = self.rootController.view.bounds.size.width;
        CGFloat height = self.rootController.view.bounds.size.height;
        UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, width, height)];
        UIImage *imageView = [UIImage imageNamed:@"TabBarBackground.png"];
        UIColor *kMainColor = [[UIColor alloc] initWithPatternImage:imageView];

        [v setBackgroundColor:kMainColor];
        [kMainColor release];

        [self.rootController.tabBar insertSubview:v atIndex:0];
        [imageView release];
        [v release];

        responseData = [[NSMutableData data] retain];
        tweets = [NSMutableArray array];
        NSURLRequest *request = [NSURLRequest requestWithURL:
                         [NSURL URLWithString:@"http://api.twitter.com/1/statuses/user_timeline.json?screen_name=ENTER_USER_HERE&count=20"]];
        [[NSURLConnection alloc] initWithRequest:request delegate:self];

        NSAssert(nil != self.rootController, @"tab bar controller not hooked up!");

        BOOL iPad = NO;
#ifdef UI_USER_INTERFACE_IDIOM
        iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
#endif

        if (iPad) {
            self.viewController = [[[exampleViewContoller alloc] initWithNibName:@"exampleViewController_iPad" bundle:nil] autorelease];
            self.viewController1 = [[example1ViewController alloc] initWithNibName:@"example1ViewController_iPad" bundle:nil] autorelease];
            self.viewController2 = [[[example2ViewController alloc] initWithNibName:@"example2ViewController_iPad" bundle:nil] autorelease];
            self.viewController3 = [[[example3ViewController alloc] initWithNibName:@"example3ViewController_iPad" bundle:nil] autorelease];
            self.viewController4 = [[[example4ViewController alloc] initWithNibName:@"example4ViewController_iPad" bundle:nil] autorelease];
        } else {
            self.viewController = [[[exampleViewContoller alloc] initWithNibName:@"exampleViewContoller_iPhone" bundle:nil] autorelease];
            self.viewController1 = [[[example1ViewController alloc] initWithNibName:@"example1ViewController_iPhone" bundle:nil] autorelease];
            self.viewController2 = [[[example2ViewController alloc] initWithNibName:@"example2ViewController2_iPhone" bundle:nil] autorelease];
            self.viewController3 = [[[example3ViewController alloc] initWithNibName:@"example3ViewController_iPhone" bundle:nil] autorelease];
            self.viewController4 = [[[example4ViewController alloc] initWithNibName:@"example4ViewController_iPhone" bundle:nil] autorelease];
        }
            self.rootController.viewControllers = [NSArray arrayWithObjects:self.viewController, self.viewController4, self.viewController1, self.viewController3, self.viewController2, nil];

        [viewController release];
        [viewController1 release];
        [viewController2 release];
        [viewController3 release];
        [viewController4 release];

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
        self.window.rootViewController = self.rootController;
#else
        [self.window addSubview:rootController.view];
#endif
        [self.window makeKeyAndVisible];
        HUD = [[MBProgressHUD alloc] initWithView:viewController.view];
        [viewController.view addSubview:HUD];
        [HUD show:NO];

        HUD.delegate = self;

        HUD.labelText = @"Loading";


        return YES;
    }

//[---CODE CLIP---]

    - (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation {
        CGFloat width = self.rootController.view.bounds.size.width*2;
        CGFloat height = self.rootController.view.bounds.size.height;
        UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, width, height)];
        UIImage *imageView = [UIImage imageNamed:@"TabBarBackground.png"];
        UIColor *kMainColor = [[UIColor alloc] initWithPatternImage:imageView];

        [v setBackgroundColor:kMainColor];
        [kMainColor release];
        [self.rootController.tabBar insertSubview:v atIndex:0];
        [imageView release];
        [v release];

    }

    - (void)hudWasHidden {
        [HUD removeFromSuperview];
    }

//[---CODE CLIP---]

    - (void)dealloc
    {
        [_window release];
        [rootController release];
        [HUD release];
        [super dealloc];
    }

    @end

The problem is that when I rotate the device in iOS Simulator, the application won’t rotate. Any ideas would be much appreciated!

UPDATE

I have also noticed that the launch image is also not rotating (for iPad that is – iPhone doesn’t do landscape launch images).

NOTE FOR JMANS

I overrode UITabBarController:

@implementation UITabBarController (MyApp)

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    if(self.selectedIndex==4) 
        return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
    else
        return (toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
@end
  • 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-24T08:22:16+00:00Added an answer on May 24, 2026 at 8:22 am

    I would start by including this in all of your view controllers:

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        return YES;
    } 
    

    Also, make sure that you are supporting multiple orientations in your Info.plist.

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

Sidebar

Related Questions

In my application i have Tab bar Controller. I want to change default color
I'm trying to implement a custom tab bar which is scrollable and has paging
This may be have a better name than custom tab completion, but here's the
I created a tab bar application, and I make the first tab a table.
I have an application set up where the window contains a tab bar controller
I have a complicated structure where I have a custom tab-bar controller that houses
How can I create a custom popup tab bar. that has a small button
how to open camera by clicking tab in tab bar application and i want
Okay, I am using a custom tab bar (not a tab based app) but
I'm getting some odd behaviour with my custom tab bar. The images seem to

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.