Question

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 new 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

Was it helpful?

Solution

Try to replace

[curController.navigationController pushViewController:pdfViewerController animated:YES];

with this:

[curController pushViewController:pdfViewerController animated:YES];

Because curController is already object of UINavigationController class

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top