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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:28:41+00:00 2026-05-30T22:28:41+00:00

My main view controller only supports landscapeleft and landscaperight. This viewcontroller in the viewDidLoad

  • 0

My main view controller only supports landscapeleft and landscaperight. This viewcontroller in the viewDidLoad has:

if ([self.navigationItem respondsToSelector:@selector(leftItemsSupplementBackButton)]) {
    self.navigationItem.leftItemsSupplementBackButton = YES;
    self.navigationItem.leftBarButtonItem = homeBBI;

    NSArray *rightNavItems = [NSArray arrayWithObjects:searchBBI, allBBI, nil];
    self.navigationItem.rightBarButtonItems = rightNavItems;
}

When I push my ReportViewController onto the stack, it looks fine. This controller also supports landscape only.

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

When I rotate the iPad 180 degrees, all looks fine. However when I pop to the main view controller, the UINavigationBar gets messed up. It basically has all the items, including the title squished to the left. The search bar I had ends up taking up 75% of the navigation bar. I created it like this in viewDidLoad of my MainViewController:

// Search Bar
    UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 150, 44)];
    self.SearchEntry = searchBar;
    self.SearchEntry.delegate = self;
    UISearchDisplayController *searchDisplayCtlr = [[UISearchDisplayController alloc] initWithSearchBar:_searchEntry contentsController:self];
    self.SearchController = searchDisplayCtlr;
    searchDisplayCtlr.searchResultsDataSource = self;
    searchDisplayCtlr.searchResultsDelegate = self;
    UIBarButtonItem *searchBBI = [[UIBarButtonItem alloc] initWithCustomView:_searchEntry];    

This does not happen in iOS 4 since I create a UIToolBar and put that as my rightBarButtonItem. Now that I’m trying to use the rightBarButtonItems iOS 5 method, I get this problem. Any thoughts? Thanks.

Edit: This also does not happen if i pop to my MainVC without rotating the iPad. It only happens if I rotate.

  • 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-30T22:28:43+00:00Added an answer on May 30, 2026 at 10:28 pm

    Did you set autoresizing masks so that the toolbar knows to resize? I imagine so if it rotates fine without the other MVC on top.

    I have had similar issues with this, in particular ensuring my main VC rotates correctly when it isn’t on screen. I’m not sure if my solution is great, but it works. When returning from another view, I check if my bounds changed and if so, clear my view (enumerate subviews and removeFromSuperview), then load them all again. Basically, keep everything you have in viewDidLoad in another method and call it from viewWillAppear. The drawing is super fast so you won’t even notice it on screen.

    Not elegant, so I’ll be watching to see if anyone has a better solution.

    Good luck,

    Damien

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

Sidebar

Related Questions

I have the main View controller which adds 2 subviews. - (void)viewDidLoad { [self
My app's main view has a uiwebview. It is white for a split second
When I push a view controller it animates properly and slides in, the only
My application launches into a navigation controller. The root view controller has a button
The View controller programming guide states this regarding view controller's usage: Each custom view
Introduction The Model-View-Controller approach has been in my head since before the holidays and
I have a UIView element which I am adding to the main view controller.
My main xib file has a tab bar controller and each tab is linked
Please, take a look at my code bellow. This part pops top view controller
I have an application composed of a main view and a secondary view which

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.