代码片段
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 中运行时,一些空间是可见的。
我该如何解决这个问题?
提前致谢 :)