小编Fab*_*bio的帖子

UIDocumentInteractionController没有显示出来

UIDocumentInteractionController当用户从中选择一个文件时,我试图从导航控制器中呈现一个tableView.

interactionControllerWithURL返回NO和委托方法documentInteractionControllerViewControllerForPreview,不会被调用的documentInteraction控制器不会出现.

当用户选择表中的项时,将执行以下代码:

    NSURL *fileURL;
    fileURL = (NSURL *)[[DataMng sharedMng] getFileInFolder:self.navigationItem.title atRow:indexPath.row type:type];

    if (self.docInteractionController == nil){
        self.docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
        if (!self.docInteractionController) {
            NSLog(@"Selected a file with estension not supported for visualization");
            return;
        }
        self.docInteractionController.delegate = self;
    }else{
        self.docInteractionController.URL = fileURL;
    }

    if(! [self.docInteractionController presentPreviewAnimated:YES]){
        NSLog(@"ERROR in presenting preview");
    }
Run Code Online (Sandbox Code Playgroud)

委托控制器(self)符合UIDocumentInteractionControllerDelegate协议,是控制器内的导航Tabbar控制器.

任何想法都将受到欢迎

iphone objective-c ios

3
推荐指数
1
解决办法
6500
查看次数

标签 统计

ios ×1

iphone ×1

objective-c ×1