0

我正在使用它来初始化文档视图。

NSString * filename = [NSString stringWithFormat:@"Document_%d",key];
NSURL *URL = [[NSBundle mainBundle] URLForResource:filename withExtension:@"pdf"];
if (URL) {
  // Initialize Document Interaction Controller
  self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];
  [self.documentInteractionController setUTI:@"com.adobe.pdf"];
  // Configure Document Interaction Controller
  [self.documentInteractionController setDelegate:self];
  // Preview PDF
  [self.documentInteractionController presentPreviewAnimated:YES];
}

有效,这就是屏幕。 在此处输入图像描述

我的问题是文章太高了。我怎样才能降低一点?感谢您的阅读。

4

1 回答 1

0

这是我找到解决方案的地方。您有 2 个选择:

//First solution
//This shows the whole status bar
[[UIApplication sharedApplication] setStatusBarHidden:NO];

//Second solution from the link below
- (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller
{
  //This hide the status bar completely
  [[[[UIApplication sharedApplication] delegate] window] setWindowLevel:UIWindowLevelStatusBar];

    return [[[[UIApplication sharedApplication] delegate] window] rootViewController];
}

使用 UIDocumentInteractionController 时隐藏状态栏?

这是因为,默认情况下,该栏未正确设置。

于 2020-06-22T08:23:58.687 回答