0
votes

In method application:didFinishLaunchingWithOptions in AppDelegate I initiate a view controller and add to navigation view controller that becomes window root view controller. Because my iPad app is only horizontal orientation all my view controllers are made for landscape.

Here is the code:

self.myViewController = [[MyViewController alloc] init];
self.myNavigationController = [[MyNavigationController alloc] initWithRootViewController: self.myViewController];
self.window.rootViewController = self.myNavigationController;
[self.window makeKeyAndVisible];

return YES;

When I put breakpoint on "self.window.rootViewController = self.myNavigationController;" line and call in console to display view details, I get following: $0 = 0x0c89d010 >

which I read the rect is orientation mode (1024 width and 748 height)

The next breakpoint that is on "return YES;" shows me this: $1 = 0x0c89d010 >

which copy an object (as far as I can see) and changes orientation (768 width and 1004 height)

This only happens in iOS5, however iOS6 works as expected

Is there any known issue with MakeKeyAndVisible method that I should know? Or may be it is lack of my understanding how makeKeyAndVisible works

1
are you implementing the orientation methods for iOS5? - tkanzakic
This has nothing to do with makeKeyAndVisible - the way orientation is handled was changed between iOS 5 and iOS 6 - Paul.s
I am implementing shouldAutorotateToInterfaceOrientation: method in my view controller to make sure it is landscape. - user1239375
You need to implement custom NavigationController, with the usage of navigationcontroller all your orientation methods would be disturbed. - nsgulliver
Can you show the implementation of shouldAutoRotateToInterfaceOrientation: and does this method get called? - Paul.s

1 Answers

0
votes

Try creating a custom UINavigationController with all the orientation methods inside it and use it in your app.

It would be something like this

CustomNavigationController.h

#import <UIKit/UIKit.h>
@interface CustomNavigationController : UINavigationController
@end

CustomNavigationController.m

#import "CustomNavigationController.h"


@interface CustomNavigationController ()

@end

@implementation CustomNavigationController


//overriding shouldAutorotateToInterfaceOrientation method for working in navController

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    return   [self.topViewController shouldAutorotateToInterfaceOrientation];

}

//other methods

This way your orientations would be working accordingly in your corresponding viewCotrollers.