Very odd iOS orientation issue with Three20

This is amongst the oddest issues with iOS development I have ever seen. I'm relatively new to iOS development, so I apologize if I'm missing something obvious or my terminology isn't completely correct. If you need clarification, please let me know in the comments and I'll edit my question accordingly.

The Problem

I'm using Three20, so that might have something to do with it. But I have a "Home view" which is basically a series of images that link out to other views (shown in the image below). If I start our in portrait view, all is well.

The next view is a table view, shown below:

YAY! I can rotate and all is right with the world. BUT if I go back to that home view, rotate to landscape, and THEN go to this tabled view, the world breaks.

You'll see that there's a random space added to the right side of my table now. I don't know where and how it came from. Here's my Controller.m file:

#import "FriendTabsController.h"
#import "MyAppApp.h"
#import "JohnDoeManager.h"

@implementation FriendTabsController

@synthesize innerView, segmentedControl, innerController, friendsController, friendRequestsController;

- (void)addBottomGutter:(UIViewController*)controller {
  if ([controller isKindOfClass:[TTTableViewController class]]) {
    TTTableViewController* tableViewController = (TTTableViewController*)controller;
    tableViewController.tableView.scrollIndicatorInsets = UIEdgeInsetsMake(0,0,50+44,0);
    tableViewController.tableView.contentInset = UIEdgeInsetsMake(0,0,50+44,0);
  }
}

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

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
  [super viewDidLoad];

  self.title = @"Friends";
  self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
  self.navigationController.navigationBar.tintColor = nil;


  friendsController = [[FriendsController alloc] init];
  friendRequestsController = [[FriendsController alloc] init];
  ((FriendsController*)friendRequestsController).friendRequests = YES;

  [self addBottomGutter:friendsController];
  [self addBottomGutter:friendRequestsController];

  innerController = friendsController;
  [innerView addSubview:innerController.view];
  [innerController viewDidLoad];

    UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
    [self loadBannerAd:(orientation)];

}
-(void) loadBannerAd:(UIInterfaceOrientation)orientation{ 

  MainLayer *mi = [MainLayer getInstance];
    if (mi.useJohnDoeAds) {
    [[JohnDoeManager sharedInstance] setCurrentViewController:self];
    [mi.JohnDoeBanner.view removeFromSuperview];

        if(orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
            // This is a portait ad
            if ([[MyAppUtils getCurrentDevice] isEqualToString:@"iphone"]) {
                [mi.JohnDoeBanner setFrame:CGRectMake(0, 410-44, 320, 50)];
            }else{
                [mi.JohnDoeBanner setFrame:CGRectMake(0, 1024-44-90-20, 768, 90)];
            }                
        } else {
            // Landscape
            if ([[MyAppUtils getCurrentDevice] isEqualToString:@"iphone"]) {
                [mi.JohnDoeBanner setFrame:CGRectMake(0, 320-44-58, 410, 50)];
            }else{
                [mi.JohnDoeBanner setFrame:CGRectMake((1024-768)/2, 768-44-90-20, 768, 90)];
            }              
        }

        [self.view addSubview:mi.JohnDoeBanner.view];
          [mi.JohnDoeBanner rollOver];           
  }
}

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
    [self loadBannerAd:(toInterfaceOrientation)];
}


- (IBAction)didChangeSegment:(UISegmentedControl *)control {
  if (innerController) {
    [innerController viewWillDisappear:NO];
    [innerController.view removeFromSuperview];
    [innerController viewDidDisappear:NO];
  }

  switch (control.selectedSegmentIndex) {
    case 0:
      innerController = friendsController;
      self.title = @"Friends";

      break;
    case 1:
      innerController = friendRequestsController;
      self.title = @"Requests";

      break;
  }
  [innerController viewWillAppear:NO];
  [innerView addSubview:innerController.view];
  [innerController viewDidAppear:NO]; 
}

- (void)viewWillAppear:(BOOL)animated {
  [super viewWillAppear:animated];
  [innerController viewWillAppear:animated];
  self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
  self.navigationController.navigationBar.tintColor = nil;
}

- (void)viewDidAppear:(BOOL)animated {
  [super viewDidAppear:animated];
  [innerController viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated {
  [innerController viewWillDisappear:animated];
  [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated {
  [innerController viewDidDisappear:animated];
  [super viewDidDisappear:animated];
}

- (void)didReceiveMemoryWarning {
  [super didReceiveMemoryWarning];
}

- (void)viewDidUnload {
  [friendsController release], friendsController = nil;
  [friendRequestsController release], friendRequestsController = nil;
  [super viewDidUnload];
}

- (void)dealloc {
  [super dealloc];
}


@end

So can someone please tell me what's going on? HELP!

Answers


You need to set wantsFullScreenLayout property to YES.

in your init methods set

self.wantsFullScreenLayout = YES;

This will solve your problem.


Need Your Help

Php Mysql SELECT * FROM tablename WHERE rowname = $variable

php mysql

As usual thanks in advance. I've searched and searched for an answer to this but come up with a blank.

Selenium/python 2.7 How to use if/else with find_element?

python selenium if-statement element

What I want is to say if element1 is displayed, click, if not check if element2 is displayed, click, etc. But my code stops when an element isnt there. If element1 is there, it clicks it, if it is ...