iOS 7文档交互控制器如何隐藏状态栏

3
在我的iOS应用中,我使用以下代码在每个视图控制器中隐藏状态栏:
- (BOOL)prefersStatusBarHidden
{
    return YES;
}

在一个视图中,我需要使用UIDocumentInteractionController,但当它出现时,状态栏会显示出来,有没有办法让它保持隐藏?
提前致谢。
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];
}

1
尝试这个对我有用:

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

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

0
documentController.delegate设置为self并使用。
- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller {
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接