2012-04-24 2 views
11

mainviewController 뷰에 UISplitViewController 뷰를 추가했습니다.이 코드는 아래에 있습니다.UISplitViewController의 presentModalViewController detail 전체 화면으로 뷰를 표시하지 않습니다.

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

지금 내가 원하는 것은 UISplitViewController의 DetailView에서의 ViewController을 제시하는 것입니다 나는 나를 클릭 DetailViewControllers 내에서 다음과 같이 그것을 위해 노력하고 있어요! 버튼을 클릭하십시오.

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

을 결과입니다 난 정말 당신의 분할보기 컨트롤러 왼쪽 및 오른쪽 (자세히보기) 왼쪽에 위치 말할 수 없습니다. 위치를 구별하기 위해 뷰의 배경색을 변경하십시오. 당신이 그들에게 문제가있는 것 같습니다.

어쨌든 Detail 대신에 splitView에서 모달 뷰 컨트롤러를 표시해 볼 수 있습니다.

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

안녕 마틴, 답장을 보내 주셔서 감사하지만 이것은 효과가 없습니다. splitviewcontroller를 사용하여 뷰 컨트롤러를 표시하면 아무것도 보이지 않습니다. – 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 크기를 제공하고 있습니다입니다 .

대신 단순히 Splitview에주고 싶은 크기를 직접 지정하십시오.

희망은 도움이 될 것입니다.

1

(iOS 5.1에서) 동일한 문제가있었습니다. modalPresentationStyle을 UIModalPresentationPageSheet로 설정하면 예상대로 작동합니다.

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 
    rViewController.modalPresentationStyle = UIModalPresentationPageSheet; 
    rViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; 
} 
관련 문제