2013-01-08 89 views
1

enter image description hereQLPreviewController - 顯示問題

代碼片段

NSMutableArray *samplepdf = [[NSMutableArray alloc]initWithObjects:@"sam1.pdf",@"sam2.pdf",@"sam3.pdf",@"sam4.pdf", nil]; 


    1) QLPreviewController *previewController = [[QLPreviewController alloc] init]; 
    previewController.dataSource = self; 
    previewController.currentPreviewItemIndex = [indexPath row]; 
    [self presentModalViewController:previewController animated:YES]; 


2) 


- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)previewController 
{ 

    return [samplepdf count]; 

} 


// returns the item that the preview controller should preview 
- (id)previewController:(QLPreviewController *)previewController previewItemAtIndex:(NSInteger)index 
{ 

    NSString *documentsDirectoryPath = [[NSBundle mainBundle]resourcePath]; 

    NSString *dataPath =[documentsDirectoryPath stringByAppendingPathComponent:[samplepdf objectAtIndex:index]]; 


    NSURL *url = [NSURL fileURLWithPath:dataPath isDirectory:YES]; 
    return url; 
} 

此代碼的工作完全在iOS5中,但是當在iOS6的一些空間IAM的運行是可見的。

我該如何解決這個問題?

感謝提前:)

回答

0

到presentModalViewController召喚:動畫:在iOS6的已被棄用。在調用presentViewController之前,您可能需要指定模式轉換樣式和模態演示樣式:animated :.你可以嘗試這樣的事情:

[previewController setModalPresentationStyle:UIModalPresentationFullScreen]; 
    [previewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal]; 

    [self presentViewController:previewController animated:YES completion:nil]; 
+0

感謝您回覆馬特龍,我爲此代碼嘗試,沒有任何效果。如果有任何方式在QLPreviewController中設置縮放級別? – Senthil

+0

我剛剛注意到你的模擬器是iPhone 5.你在iPhone 4模擬器上測試了這個代碼,屏幕尺寸較短?你在那裏得到同樣的問題嗎?如果沒有,你可能想看看http://stackoverflow.com/questions/12395200/how-to-develop-or-migrate-apps-for-iphone-5-screen-resolution –