Załaduj różne pliki xib na orientację w iOS

Stworzyłem dwa.xib plik jeden dla trybu portretowego i inny dla trybu poziomego,

na każdym obrocie chcę załadować odpowiednie.xib plik,

Oto mój fragment kodu,

Klasa ViewAppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    if ([UIApplication sharedApplication].statusBarOrientation==UIInterfaceOrientationPortrait | [UIApplication sharedApplication].statusBarOrientation==UIInterfaceOrientationPortraitUpsideDown)
    {
        self.viewController = [[OrientationViewController alloc] initWithNibName:@"PortraitController" bundle:nil];
        UINavigationController *navigationController=[[UINavigationController alloc] initWithRootViewController:self.viewController];
        self.window.rootViewController = navigationController;
    }
    else{
        self.viewController = [[OrientationViewController alloc] initWithNibName:@"LandscapeController" bundle:nil];
        UINavigationController *navigationController=[[UINavigationController alloc] initWithRootViewController:self.viewController];
        self.window.rootViewController = navigationController;
    }

    [self.window makeKeyAndVisible];
    return YES;
}

Klasa ViewController.m

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

}

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


-(void)viewWillLayoutSubviews{

    if ([UIApplication sharedApplication].statusBarOrientation==UIInterfaceOrientationPortrait | [UIApplication sharedApplication].statusBarOrientation==UIInterfaceOrientationPortraitUpsideDown) 
    {
        [[NSBundle mainBundle] loadNibNamed:@"PortraitController" owner:self options:nil];
    }
    else{
        [[NSBundle mainBundle] loadNibNamed:@"LandscapeController" owner:self options:nil];
    }

}

Po napisaniu tak dużej ilości kodu moja aplikacja nic nie pokazuje .. pokazuje tylko czarny ekran.

proszę zaproponować jakieś rozwiązanie.

questionAnswers(3)

yourAnswerToTheQuestion