在预览文档时删除右侧导航项

时间:2014-08-01 12:06:44

标签: ios uinavigationcontroller uinavigationbar

我在didSelectRowAtIndexPath中执行以下代码,文档正在打开,但未删除右侧导航项。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (url) {
        self.pdf_viewer = [UIDocumentInteractionController interactionControllerWithURL:url];
        [self.pdf_viewer setDelegate:self];
        [self.pdf_viewer presentPreviewAnimated:YES];
     }
}

- (UIViewController *)documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller {
    self.navigationItem.rightBarButtonItem = nil;
    return self;
}

1 个答案:

答案 0 :(得分:0)

在文档打开时,执行rightBarButtonItem = nil

if (url) {
    self.pdf_viewer = [UIDocumentInteractionController interactionControllerWithURL:url];
    [self.pdf_viewer setDelegate:self];
    [self.pdf_viewer presentPreviewAnimated:YES];
   self.navigationItem.rightBarButtonItem = nil;
}

关闭文档后再次设置按钮..