Ios 目标-C didSelectRowAtIndexPath无法使用UIDocumentInteractionController

Ios 目标-C didSelectRowAtIndexPath无法使用UIDocumentInteractionController,ios,objective-c,Ios,Objective C,我正在使用UIDocumentInteractionController显示PDF。用户从表视图中选择要显示的PDF 当我查看完PDF并单击“完成”按钮后,我的表格视图将重新加载,并显示出来。但是表格视图显示为冻结状态,无法向上或向下滚动。因此,我的didSelectRowAtIndexPath方法不起作用 这是我的密码: NSString *filePath = [NSString stringWithFormat:@"%@/%@", [datasource PDFFilePath], [ff

我正在使用UIDocumentInteractionController显示PDF。用户从表视图中选择要显示的PDF

当我查看完PDF并单击“完成”按钮后,我的表格视图将重新加载,并显示出来。但是表格视图显示为冻结状态,无法向上或向下滚动。因此,我的didSelectRowAtIndexPath方法不起作用

这是我的密码:

NSString *filePath = [NSString stringWithFormat:@"%@/%@", [datasource PDFFilePath], [ffd fileFolderName]];

    NSURL *URL = [NSURL fileURLWithPath:filePath];

    if (URL)
    {
        self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];

        [self.documentInteractionController setDelegate:self];

        [self.documentInteractionController presentPreviewAnimated:YES];
    }

- (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller {
    return self;
}

- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller
{
    [_tableView reloadData];
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    FileFolderData *ffd =
    [[datasource.finalData valueForKey:
      [[[datasource.finalData allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)] objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];

    if ([ffd isFile])
    {
        [_tableView setUserInteractionEnabled:NO];
    }

    [self performSelector:@selector(SwitchFolders:) withObject:indexPath afterDelay:0.1f];
}
我的问题是,如何让UITableView在查看PDF后再次工作

我得到这个错误

从不兼容的类型“ViewController*const\u strong”分配给“id\u Nullable”

在这一行:

_tableView.dataSource=self

但这可能是无关的

其他代码:

- (void)SwitchFolders:(NSIndexPath *)indexPath
{
    FileFolderData *ffd =
    [[datasource.finalData valueForKey:
      [[[datasource.finalData allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)] objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];

    if([ffd isFolder])
    {
        [datasource GetFilesAndFolders:[ffd fileFolderName] :NO];
        [_tableView reloadData];
        [_tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationTop];
    }
    else if ([ffd isFile])
    {
        [self performSelectorInBackground:@selector(DownloadPDF:) withObject:ffd];
    }


}
当选定单元格时,将调用此函数。使用UIDocumentInteractionController后再次选择单元格无效

更多代码

- (void)PDFDownloadSuccess:(FileFolderData *)ffd
{
    NSString *filePath = [NSString stringWithFormat:@"%@/%@", [datasource PDFFilePath], [ffd fileFolderName]];

    NSURL *URL = [NSURL fileURLWithPath:filePath];

    if (URL)
    {
        self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];

        [self.documentInteractionController setDelegate:self];

        [self.documentInteractionController presentPreviewAnimated:YES];
    }

}
以下是PDFSuccessDownload的调用方式:

- (void)DownloadPDF:(FileFolderData *)ffd
{

    if([datasource PDFDownload_ASynch:[ffd fileFolderName]])
    {
        [self performSelectorOnMainThread:@selector(PDFDownloadSuccess:) withObject:ffd waitUntilDone:YES];
    }
    else
    {
        [self performSelectorOnMainThread:@selector(PDFDownloadFail:) withObject:ffd waitUntilDone:YES];
    }

}

DownloadPDF由SwitchFolders方法调用,该方法在选择单元格时调用。

通过执行以下操作修复了此问题:

- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller
{
    [_tableView setUserInteractionEnabled:YES];
}

在PDF关闭后,将UITableView的用户交互设置为“是”。

我已使用其他代码更新了我的问题。添加了更多方法以及调用这些方法的时间。让我们来看看。