0

I just started learning to write iPhone app (maybe a little too late) from a book I picked up from the library "Beginning iPhone Games Development" published by APress. I now come to believe it's written for XCode 3. But at this time, XCode 4.3.1 with iOS 5 SDK is what I can download.

The book lists a code block:

// XCODE 3: changing to landscape orientation in AppDelegate.m
- (void) applicationDidFinishLaunching:(UIApplication*)application {
   [application setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
   [application setStatusBarHidden:YES animated:NO];
   [window addSubView:viewController.view];
   [window makeKeyAndVisible];
}

After quite some struggle, I conclude that there are significant changes between the two XCode versions as it did not mention any changes that needs to be done to AppDelegate.h or connecting view/controller IBOutlets.

Can anyone please show me a good reference about the changes as well as what could be the same code in Xcode 4.3.1?

Hailei
  • 42,163
  • 6
  • 44
  • 69
Jake
  • 11,273
  • 21
  • 90
  • 147

1 Answers1

1

From a single view application created by template in Xcode 4.3.2:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}

Many things changed, not only from iOS 3 to iOS 5, but also from Xcode 3 to Xcode 4. You may find it a bit hard to refer to books written for Xcode 3 when you are using Xcode 4.

P.S. There is a new book Beginning iOS 5 Games Development from Apress, but I don't have any comments since I haven't read it.

Hailei
  • 42,163
  • 6
  • 44
  • 69
  • Sadly, I wasn't aware of the differences when I got the book. Since I had zero knowledge, I just picked the best available. – Jake Apr 23 '12 at 13:11