I’m trying to support landscape mode in my gl iOS application. I have a window, a gl view, and a view controller with one method, shouldAutorotateToInterfaceOrientation, which returns YES. This is how I set them up:
window = [[UIWindow alloc] initWithFrame:rect];
GLView *glView = [[GLView alloc] initWithFrame:rect];
glView.delegate = self;
view_controller = [ViewController alloc];
view_controller.view = glView;
window.rootViewController = view_controller;
This happens on the method applicationDidFinishLaunching. The problem is that the method shouldAutorotateToInterfaceOrientation gets called only once, for the portrait mode. I still get events on my view, but the method for auto rotate never gets called again.
Am I setting this up right? There are no nib files, just code.
Thanks.
You should be calling init on your ViewController instance (is it a UIViewController subclass?)
You should be overriding the following UIViewController methods
The call to should autorotate does not mean that the rotation will take place, this is explained in the UIViewController class reference