2013-10-16 60 views
3

在我的iOS应用程序我已经隐藏状态栏与此代码中的每个视图控制器:IOS 7文档交互控制器隐藏状态栏

- (BOOL)prefersStatusBarHidden 
{ 
    return YES; 
} 

在视图中我需要使用UIDocumentInteractionController,但说到状态栏出现,是否有办法隐藏它?

在此先感谢

回答

0

设置documentController.delegate自我和使用

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

这不适用于iOS 7 :-( – allemattio

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]; 
}