【问题标题】:ios 7 document interaction controller hide status barios 7 文档交互控制器隐藏状态栏
【发布时间】:2013-10-16 08:41:07
【问题描述】:
在我的 iOS 应用程序中,我已在每个 ViewController 中使用此代码隐藏状态栏:
- (BOOL)prefersStatusBarHidden
{
return YES;
}
在一个视图中我需要使用一个UIDocumentInteractionController,但是当它出现时,状态栏出现了,有没有办法让它隐藏起来?
提前致谢
【问题讨论】:
标签:
iphone
ios
objective-c
xcode
statusbar
【解决方案1】:
结合使用以下代码和来自 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];
}
【解决方案2】:
试试这个对我有用:
- (void)documentInteractionControllerWillBeginPreview:(UIDocumentInteractionController *)controller
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
【解决方案3】:
将documentController.delegate设置为self并使用
- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller {
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}