3

在我的 iOS 应用程序中,我在每个 ViewController 中隐藏了带有此代码的状态栏:

- (BOOL)prefersStatusBarHidden
{
    return YES;
}

在视图中我需要使用 UIDocumentInteractionController,但是当它出现时,会出现状态栏,有没有办法让它隐藏起来?

提前致谢

4

3 回答 3

2

结合使用以下代码和 iOS 中的代码:

- (UIViewController *) documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *) controller {
  // hack to keep status bar visible
  [[NSOperationQueue mainQueue] addOperationWithBlock:
    ^{
      [[UIApplication sharedApplication] setStatusBarHidden:NO];
  }];
  return self;
}

结合

- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller {
  [[UIApplication sharedApplication] setStatusBarHidden:YES];
}
于 2015-08-13T18:45:28.573 回答
1

试试这个对我有用:

- (void)documentInteractionControllerWillBeginPreview:(UIDocumentInteractionController *)controller
{
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
}

- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller
{
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
}
于 2015-08-26T11:38:54.707 回答
0

设置documentController.delegate为自我并使用

- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller {
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
}
于 2013-10-16T11:20:45.137 回答