Push a view controller from root to detail view controller (SplitView)
My splitview contains UITable (Masterview) and tabbar with navigationcontroller on each tabbaritem (Detailview). What I want to have is when I click on tablerow in Masterview, it will push a new view in detail view controller.
I wrote this iteration to get the right UINavigationController and push the n开发者_运维技巧ew view. Unfortunately this doesn't work. It doesn't show the new view and sometimes it just crashed.
// code from MasterView
PDFViewer *pdfViewerController = [[PDFViewer alloc] initWithNibName:@"PDFViewer" bundle:nil];
pdfViewerController.pdfData = [[NSData alloc] initWithData: pdfContent];
pdfViewerController.docInfo = curDocInfo;
// gets tabbar controllers
XtendisAppDelegate *appDelegate = (XtendisAppDelegate *)[[UIApplication sharedApplication] delegate];
NSMutableArray *controllers = [NSMutableArray arrayWithArray: appDelegate.tabBarController.viewControllers];
for (UIViewController *curController in controllers) {
if ([curController isKindOfClass:[UINavigationController class]]) {
[curController.navigationController pushViewController:pdfViewerController animated:YES];
break;
}
}
[pdfViewerController release];
Any idea what did i do wrong? Any help appreciated. Thank's in advance.
Cheers, Inoel
Try to replace
[curController.navigationController pushViewController:pdfViewerController animated:YES];
with this:
[curController pushViewController:pdfViewerController animated:YES];
Because curController
is already object of UINavigationController class
精彩评论