Hi there!
I've read somewhere that the "shouldAutorotateToInterfaceOrientation" method must be placed in a UIViewController class and NOT in a UIView class, which is quite disgusting for me because I have ALL my logic and drawing methods in a UIView class... How can I add a UIViewController related to my UIView class to just handle rotation but don't have to move all my game logics and graphics into it?
Here's how my UIView subclass (named EAGLView) is called from the AppDelegate:
Code:
// myGameAppDelegate.h
#import <UIKit/UIKit.h>
// The EAGLView class inherits from a UIView
@class EAGLView;
@interface myGameAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
EAGLView *glView;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet EAGLView *glView;
@end
Code:
// myGameAppDelegate.m
#import "myGameAppDelegate.h"
#import "EAGLView.h"
@implementation myGameAppDelegate
@synthesize window;
@synthesize glView;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Here is where the EAGLView class is initialized...
glView.animationInterval = 1.0 / 60.0;
[glView startAnimation];
}
It's easy to add a UIViewController "layer" to let me handle rotation but still maintain my app structure?
Thanks in advance!