2012-04-24 14 views
11

tam ekranda görünümü sunan değil de, kod aşağıda presentModalViewController.UISplitViewControllers DetailView görüntülerim benim mainViewControllers içinde UISplitViewController görünümü ekledik

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

şimdi ne istediğim UISplitViewController ait DetailView bir ViewController sunmaktır ben Click Me DetailViewControllers içine aşağıdaki gibi bunu yapmak için çalışıyorum! düğmelerini tıklayın.

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

ama bu tuhaf bir sunumda Ekran görüntüleri ise

enter image description here

kimse sorun peşin sayesinde, burada ne önerebilirsiniz ..

+0

kuyu açıkladı !! –

+0

@Vishal nopes .. Yine de bunun iyileştirilmesi gerektiğini düşünüyorum ama evet ilk kez onun k;) –

+0

@Shashank da aynı sorunla karşı karşıyayız. çözdün mü? – Hitarth

cevap

2

çıkan edilir Bölünmüş görüntü denetleyicinizin nerede sol ve sağ tarafın (ayrıntı görünümü) bulunduğu nerede olduğunu söyleyemiyorum. Konumları ayırt etmek için görünümlerin arka plan renklerini değiştirin. Onlarla sorunların var gibi görünüyor.

Neyse, bunun yerine Detay SplitView gelen kalıcı görünüm denetleyicisi sunan deneyebilirsiniz.

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

Merhaba Martin, cevabınız için teşekkürler, ancak bu işe yaramadı. splitviewcontroller kullanarak görünüm denetleyicisi sunulması hiçbir şey göstermiyor. – Shashank

2

inanıyorum burada modally görüntülemek istediğiniz görünümü denetleyicisi (isteğe bağlı olarak ve modalTransitionStyle) modalPresentationStyle değişiyor hüner: buldum Ne

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

Eğer cetralArea.frame.size.width gibi SplitView boyutunu veriyoruz olduğunu .

Bunun yerine, Splitview'a vermek istediğiniz büyüklüğü doğrudan verin.

Umut sizin için çalışacaktır.

1

Aynı sorunu yaşadım (iOS 5.1'de). ModalPresentationStyle'ı UIModalPresentationPageSheet'e ayarlayın ve beklendiği gibi çalışmalıdır.

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 
    rViewController.modalPresentationStyle = UIModalPresentationPageSheet; 
    rViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; 
} 
İlgili konular