1
代碼片段
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的運行是可見的。
我該如何解決這個問題?
感謝提前:)
感謝您回覆馬特龍,我爲此代碼嘗試,沒有任何效果。如果有任何方式在QLPreviewController中設置縮放級別? – Senthil
我剛剛注意到你的模擬器是iPhone 5.你在iPhone 4模擬器上測試了這個代碼,屏幕尺寸較短?你在那裏得到同樣的問題嗎?如果沒有,你可能想看看http://stackoverflow.com/questions/12395200/how-to-develop-or-migrate-apps-for-iphone-5-screen-resolution –