I'm trying to display a UIViewController which displays a pdf file (PDFReaderViewController). I have a tabBarController with 4 tabs. I want to select the 4th tab, which is a UITableView with a list of files, and display the pdf with a navigation bar at the top. When the user is done viewing the pdf he can navigate back to the UITableView (4th tab). I'm able to display the 4th tab view but I can't get it to display the pdf. Here is my code:
PDFReaderViewController *pdfController = [[PDFReaderViewController alloc] init];
[pdfController initwithName:fileName];
//display the right tab view
UIViewController *currView = [tabBarController.viewControllers objectAtIndex:3];
[tabBarController setSelectedViewController:currView];
[window insertSubview:tabBarController.view atIndex:0];
[[currView navigationController] pushViewController:pdfController animated:YES];///this is not showing!!!!
[currView loadView];
[pdfController release];
[window makeKeyAndVisible];
What am I doing wrong here? Thanks for your help!