cocoaTouch/SplitViewRootController.m
changeset 3335 2520ee7a5484
parent 3332 3c90a923f156
child 3352 ac5d14a35482
equal deleted inserted replaced
3334:f94a52a763d4 3335:2520ee7a5484
     7 //
     7 //
     8 
     8 
     9 #import "SplitViewRootController.h"
     9 #import "SplitViewRootController.h"
    10 #import "MasterViewController.h"
    10 #import "MasterViewController.h"
    11 #import "DetailViewController.h"
    11 #import "DetailViewController.h"
       
    12 #import "CommodityFunctions.h"
    12 
    13 
    13 @implementation SplitViewRootController
    14 @implementation SplitViewRootController
    14 @synthesize detailViewController;
    15 @synthesize detailViewController;
    15 
    16 
    16 
    17 
    17 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    18 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    18     return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
    19     return rotationManager(interfaceOrientation);
    19 }
    20 }
    20 
    21 
    21 -(void) didReceiveMemoryWarning {
    22 -(void) didReceiveMemoryWarning {
    22     // Releases the view if it doesn't have a superview.
    23     // Releases the view if it doesn't have a superview.
    23     [super didReceiveMemoryWarning];    
    24     [super didReceiveMemoryWarning];    
    26 
    27 
    27 // load the view programmatically; we need a splitViewController that handles a MasterViewController 
    28 // load the view programmatically; we need a splitViewController that handles a MasterViewController 
    28 // (which is just a UITableViewController) and a DetailViewController where we present options
    29 // (which is just a UITableViewController) and a DetailViewController where we present options
    29 -(void) viewDidLoad {
    30 -(void) viewDidLoad {
    30     self.detailViewController = [[DetailViewController alloc] initWithStyle:UITableViewStyleGrouped];
    31     self.detailViewController = [[DetailViewController alloc] initWithStyle:UITableViewStyleGrouped];
    31      [detailViewController release];
    32     [detailViewController release];
    32     UINavigationController *detailedNavController = [[UINavigationController alloc] initWithRootViewController:self.detailViewController];
    33     UINavigationController *detailedNavController = [[UINavigationController alloc] initWithRootViewController:self.detailViewController];
    33     [detailViewController release];
    34     [detailViewController release];
    34 
    35 
    35     id splitViewRootController;
    36     id splitViewRootController;
    36     
    37     
    49 
    50 
    50         [splitViewRootController setViewControllers:[NSArray arrayWithObjects: mainNavController, detailedNavController, nil]];
    51         [splitViewRootController setViewControllers:[NSArray arrayWithObjects: mainNavController, detailedNavController, nil]];
    51         [mainNavController release];
    52         [mainNavController release];
    52         [detailedNavController release];
    53         [detailedNavController release];
    53         
    54         
    54         [splitViewRootController setDelegate: self.detailViewController];
    55         [splitViewRootController setDelegate:self.detailViewController];
    55         [detailViewController release];
    56         [detailViewController release];
    56 
    57 
    57         // add view to main controller
    58         // add view to main controller
    58         [self.view addSubview:[splitViewRootController view]];
    59         [self.view addSubview:[splitViewRootController view]];
    59         //[splitViewRootController release];
    60         //[splitViewRootController release];