4 Replies Latest reply: Jul 19, 2011 8:39 AM by xnav
Conundrum Level 1 Level 1 (5 points)

/*Can somebody please explain how shouldAutorotateToInterfaceOrientation is receiving its orientation values in the WhichWayIsUp, Apple supplied, sample code below? Thank you very much!

*/

 

#import "WhichWayIsUpAppDelegate.h"

#import "CrateViewController.h"

 

@implementation WhichWayIsUpAppDelegate

 

@synthesize window;

@synthesize crateViewController;

 

 

- (void)applicationDidFinishLaunching:(UIApplication *)application {

  // add the CreateViewController's view to the window as a subview

          [window addSubview:crateViewController.view];

}

 

- (void)dealloc {

  // release objects defined at the top-level of the nib file

          [crateViewController release];

          [window release];

          [super dealloc];

}

 

@end

 

 

#import "CrateViewController.h"

 

@implementation CrateViewController

 

// Subclasses override this method to define how the view they control will respond to device rotation

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrienta tion {

  return YES;

}

 

@end

 

 

#import <UIKit/UIKit.h>

 

int main(int argc, char *argv[]) {

 

          NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

          int retVal = UIApplicationMain(argc, argv, nil, nil);

          [pool release];

          return retVal;

}


MacBook Pro, Mac OS X (10.6.7)