Quicklook / QLPreviewController,iOS 8的一些问题,但一切都适用于iOS 7.1

前端之家收集整理的这篇文章主要介绍了Quicklook / QLPreviewController,iOS 8的一些问题,但一切都适用于iOS 7.1前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用QuickLook查看PDF文件.

它在iOS 7.1中正常工作,但iOS 8 GM会出现一些问题.

图片文字好,我想告诉你问题:

iOS 7.1 Xcode 6(工作正常)

使用QuickLook进行转换(没有失败)

页面滚动,navigationBar隐藏得很好

————————————————– ————————

而现在,iOS 8 GM与Xcode 6

使用QuickLook进行转换…

页面滚动,navigationBar不隐藏,页面指示器隐藏在NavigationBar后面

与iPhone模拟器,iPad模拟器,iPhone设备和iPad设备相同的问题.

你可以在这里看到我的源代码

- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)previewController
{
    NSInteger numToPreview = 0;
    if (currentSection == CVSectionConvocations)
        numToPreview = self.convocation.convocations.count;
    else if (currentSection == CVSectionAttachments)
        numToPreview = self.convocation.attachements.count;
    return numToPreview;
}

- (id)previewController:(QLPreviewController *)previewController previewItemAtIndex:(NSInteger)idx
{
    PDF *pdf;
    if (currentSection == CVSectionConvocations)
        pdf = self.convocation.convocations[idx];
    else if (currentSection == CVSectionAttachments)
        pdf = self.convocation.attachements[idx];
    return [pdf path];
}



- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    // determine section
    currentSection = (indexPath.section == 0 ? CVSectionConvocations : CVSectionAttachments);

    PDF *pdf;
    if (currentSection == CVSectionConvocations)
        pdf = self.convocation.convocations[indexPath.row];
    else if (currentSection == CVSectionAttachments)
        pdf = self.convocation.attachements[indexPath.row];

    if ([pdf isStored]) {
        QLPreviewController *previewController = [[QLPreviewController alloc] init];
        previewController.dataSource = self;
        previewController.delegate = self;

        previewController.currentPreviewItemIndex = indexPath.row;
        [[self navigationController] pushViewController:previewController animated:YES];
    } else {
        [self displayMessage:@"Document not found" title:@"Oups !"];
    }
}

谢谢你的帮助 原文链接:https://www.f2er.com/iOS/331435.html

猜你在找的iOS相关文章