AppDelegate.m 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //
  2. // AppDelegate.m
  3. // iOSDemo
  4. //
  5. // Created by adam on 29/09/2012.
  6. // Copyright (c) 2012 na. All rights reserved.
  7. //
  8. #import "AppDelegate.h"
  9. #import "MasterViewController.h"
  10. #import "DetailViewController.h"
  11. @implementation AppDelegate
  12. @synthesize window = _window;
  13. @synthesize navigationController = _navigationController;
  14. @synthesize splitViewController = _splitViewController;
  15. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  16. {
  17. [SVGKit enableLogging];
  18. #if DSFDSF
  19. self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
  20. // Override point for customization after application launch.
  21. if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
  22. MasterViewController *masterViewController = [[[MasterViewController alloc] initWithNibName:@"MasterViewController_iPhone" bundle:nil] autorelease];
  23. self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];
  24. self.window.rootViewController = self.navigationController;
  25. } else {
  26. MasterViewController *masterViewController = [[[MasterViewController alloc] initWithNibName:@"MasterViewController_iPad" bundle:nil] autorelease];
  27. UINavigationController *masterNavigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];
  28. /**
  29. ADAM: NB: I had to rename the XIB file.
  30. Apple is so bad at testing, Xcode 4.5 apparently re-introduces several regression bugs
  31. that are 2-3 years old, where it overwrites new files with the contents of
  32. old files at build time, and it is impossible to get it to use the real file.
  33. Even restarting didn't fix Xcode, but renaming the file does.
  34. */
  35. DetailViewController *detailViewController = [[[DetailViewController alloc] initWithNibName:@"iPadDetailViewController" bundle:nil] autorelease];
  36. UINavigationController *detailNavigationController = [[[UINavigationController alloc] initWithRootViewController:detailViewController] autorelease];
  37. masterViewController.detailViewController = detailViewController;
  38. self.splitViewController = [[[UISplitViewController alloc] init] autorelease];
  39. self.splitViewController.delegate = detailViewController;
  40. self.splitViewController.viewControllers = [NSArray arrayWithObjects:masterNavigationController, detailNavigationController, nil];
  41. self.window.rootViewController = self.splitViewController;
  42. }
  43. #endif
  44. // [self.window makeKeyAndVisible];
  45. return YES;
  46. }
  47. - (void)applicationWillResignActive:(UIApplication *)application
  48. {
  49. // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
  50. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
  51. }
  52. - (void)applicationDidEnterBackground:(UIApplication *)application
  53. {
  54. // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
  55. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  56. }
  57. - (void)applicationWillEnterForeground:(UIApplication *)application
  58. {
  59. // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
  60. }
  61. - (void)applicationDidBecomeActive:(UIApplication *)application
  62. {
  63. // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
  64. }
  65. - (void)applicationWillTerminate:(UIApplication *)application
  66. {
  67. // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  68. }
  69. @end