2012-04-24 7 views
11

mainviewControllerビューにUISplitViewControllerビューを追加しました。コードは以下のとおりです。UISplitViewControllersのpresentModalViewController detailViewビューをフルスクリーンで表示しない

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]; 

は今、私が何をしたい、私は私をクリックしてDetailViewControllersの内側に、以下のようにそれを行うにしようとしていますUISplitViewControllerのDetailViewからのViewControllerを提示することです!ボタンをクリックします。

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] initWithReaderDocument:readerDocument];   
     rViewController.delegate = self; // Set the ReaderViewController delegate to self    

     [self presentModalViewController:rViewController animated:NO];   
    } 
} 

が、これは誰もが、ここでは事前のおかげで、問題が何であるかを提案することができます厄介なプレゼンテーションに

enter image description here

を結果ます。..

+0

よく説明されています! –

+0

@ Vishal nopes ..私はまだ改善する必要があると思うけど、最初はそのk;) –

+0

@Shashank私たちも同じ問題に直面している。あなたはそれを解決しましたか? – Hitarth

答えて

2

あなたのスクリーンショットでスプリットビューコントローラーの左側と右側(詳細ビュー)がどこにあるのかは分かりません。位置を区別するためにビューの背景色を変更します。あなたに問題があるようです。

とにかく、詳細の代わりにsplitViewからモーダルビューコントローラを表示することができます。

[splitViewController presentModalViewController:rViewController animated:NO]; 
+0

こんにちはMartin、返事ありがとうございますが、これはうまくいきません。 splitviewcontrollerを使用してView Controllerを表示しても何も表示されません。 – Shashank

2

私は信じてここにあなたがモーダルで表示するビューコントローラの(オプションとmodalTransitionStyle)modalPresentationStyle変化しているトリック:私が見つけた何

ReaderViewController *rViewController = [[ReaderViewController alloc] initWithReaderDocument:readerDocument];   
    rViewController.delegate = self; // Set the ReaderViewController delegate to self    

    rViewController.modalPresentationStyle = UIModalPresentationFullScreen; 
    rViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;  
    [self presentViewController:rViewController animated:YES completion:nil]; 
0

あなたはcetralArea.frame.size.widthようsplitviewサイズを与えているです。

代わりに、単にスプリットビューに与えたいサイズを直接入力します。

うまくいくと思います。

1

私は同じ問題を抱えていました(iOS 5.1)。 modalPresentationStyleをUIModalPresentationPageSheetに設定すると、期待通りに機能するはずです。

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 
    rViewController.modalPresentationStyle = UIModalPresentationPageSheet; 
    rViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; 
} 
関連する問題