views:

38

answers:

0

Hi all,

I'm writing an iPad app, and I have the following screen situation:

MainAppWindow
   MainView & MainViewController  (Full Screen)
      SubView1 & SubView1Controller (250x300) inside of MainView
         DetailsView1 (Root View)   <-- Managed by UINavigationController
         DetailsView2 (Next View)   <-- Managed by UINavigationController

So here is what I'm doing:

In App Delegate:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
   MainViewController *mainvViewController=[[[MainViewController alloc] initWithNibName:@"MainView" bundle:nil] autorelease];
   [window insertSubview:mainvViewController.view atIndex:0];
   [window makeKeyAndVisible];
   return YES;
}

In MainViewController:

- (void)viewDidLoad {
   [super viewDidLoad];
   SubView1Controller *subView1Controller=[[[SubView1Controller alloc] initWithNibName:@"SubView1" bundle:nil] autorelease];
   CGRect r = [subView1Controller.view frame];
   r.origin.x = 50;
   r.origin.y = 50;
   [subView1Controller.view setFrame:r];
   [self.view insertSubview:subView1Controller.view atIndex:0]; 
}

in SubViewController:

- (void)viewDidLoad {
   [super viewDidLoad];
   DetailsView1Controller *detailsView1Controller=[[[DetailsView1Controller alloc] initWithNibName:@"DetailsView1" bundle:nil] autorelease];
   DetailsView2Controller *detailsView2Controller=[[[DetailsView2Controller alloc] initWithNibName:@"DetailsView2" bundle:nil] autorelease];
   // Create the nav controller and add the view controllers.
   UINavigationController*  theNavController = [[[UINavigationController alloc]                                 initWithRootViewController:detailsView1Controller] autorelease];
   [theNavController pushViewController:detailsView2Controller animated:NO];
   theNavController.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
   theNavController.delegate=self;
   // Display the nav controller modally.
   [self presentModalViewController:theNavController animated:YES]; 
}

However, running the above shows only the main view and subview, but not the DetailView1 or DetailView2 which are the root & next views inside of the programmatically created navigation controller. Here is a screen shot of what I see:

http://img697.imageshack.us/img697/7595/screenshot20100703at244.png