Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #import <UIKit/UIKit.h>
  2.  
  3. #pragma mark Detail interface
  4. @interface Detail : UIViewController {}
  5. @end
  6. #pragma mark Detail implementation
  7. @implementation Detail
  8. @end
  9.  
  10. #pragma mark RootViewController interface
  11. @interface RootViewController : UITableViewController {}
  12. @end
  13. #pragma mark RootViewController implementation
  14. @implementation RootViewController
  15.  
  16. - (void)viewWillAppear:(BOOL)animated {
  17.     [super viewWillAppear:animated];
  18.     self.title = @"root";
  19. }
  20.  
  21. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; }
  22. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 1; }
  23.  
  24. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  25.     static NSString *CellIdentifier = @"Cell";
  26.     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  27.     if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; }
  28.     cell.textLabel.text = @"Click meee";
  29.     return cell;
  30. }
  31.  
  32. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  33.     Detail *detailViewController = [[Detail alloc] initWithNibName:@"Detail" bundle:nil];
  34.     [self.navigationController pushViewController:detailViewController animated:YES];
  35. #pragma mark QUESTION
  36.     //Why doesn't this release show up in Instruments?
  37.     [detailViewController release];
  38. }
  39. @end
  40.  
  41.  
  42. #pragma mark PopDeallocAppDelegate interface
  43. @interface PopDeallocAppDelegate : NSObject <UIApplicationDelegate> {
  44.     UIWindow *window;
  45.     UINavigationController *navigationController;
  46. }
  47. @property (nonatomic, retain) IBOutlet UIWindow *window;
  48. @property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
  49. @end
  50.  
  51. #pragma mark PopDeallocAppDelegate implementation
  52. @implementation PopDeallocAppDelegate
  53. @synthesize window;
  54. @synthesize navigationController;
  55.  
  56. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
  57.     [window addSubview:navigationController.view];
  58.     [window makeKeyAndVisible];
  59.     return YES;
  60. }
  61.  
  62. - (void)applicationWillResignActive:(UIApplication *)application {}
  63. - (void)applicationDidEnterBackground:(UIApplication *)application {}
  64. - (void)applicationWillEnterForeground:(UIApplication *)application {}
  65. - (void)applicationDidBecomeActive:(UIApplication *)application {}
  66. - (void)applicationWillTerminate:(UIApplication *)application {}
  67. - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {}
  68. - (void)dealloc {
  69.     [navigationController release];
  70.     [window release];
  71.     [super dealloc];
  72. }
  73.  
  74.  
  75. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement