Alex Rivera | Logout

presentModalViewController in UISplitViewControllers detailView not presenting the view in full screen

Asked 2012-04-24T12:10:32.493
11

I have added the UISplitViewController view in my mainViewControllers view, the code is below.

    documentsRootViewController = [[DocumentsRootViewController alloc] initWithStyle:UITableViewStylePlain];
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:documentsRootViewController];
    documentsRootViewController.title = @"Document List";

    documentDetailView = [[DocumentsDetailView alloc] initWithNibName:@"DocumentsDetailView" bundle:nil];
    documentsRootViewController.detailViewController = documentDetailView;

    docSplitViewController = [[UISplitViewController alloc] init];
    docSplitViewController.viewControllers = [NSArray arrayWithObjects:navigationController, documentDetailView, nil];
    docSplitViewController.delegate = documentDetailView;

    CGRect splitViewFrame = CGRectMake(0, 0, cetralArea.frame.size.width, cetralArea.frame.size.height);         
    docSplitViewController.view.frame = splitViewFrame;
    [cetralArea addSubview:docSplitViewController.view];

now what I want is to present a ViewController from the DetailView of the UISplitViewController I am trying to do it as below inside the DetailViewControllers Click Me! buttons click.

enter image description here

- (IBAction) buttonClicked:(id)sender
{
    NSString *phrase = nil; // Document password (for unlocking most encrypted PDF files)    
    NSArray *pdfs = [[NSBundle mainBundle] pathsForResourcesOfType:@"pdf" inDirectory:nil];    
    NSString *filePath = [pdfs lastObject]; assert(filePath != nil); // Path to last PDF file

    ReaderDocument *readerDocument = [ReaderDocument withDocumentFilePath:filePath password:phrase];    
    if (readerDocument != nil) // Must have a valid ReaderDocument object in order to proceed with things
    {
        ReaderViewController *rViewController = [[ReaderViewController alloc]
Edit
Report

1 Answer

2

In your screenshots I can't really tell where is your split view controller left side and right side (detail view) located. Change background colors of the views to distinguish positions. Seems you are having problems with them.

Anyways, you can try presenting the modal view controller from the splitView instead of the Detail.

[splitViewController presentModalViewController:rViewController animated:NO];
answered 2012-04-24T13:46:06.430

Your Answer