ios - 强制应用程序显示状态栏

标签 ios swift

我在我的项目中使用广告客户端。广告客户端隐藏应用程序的状态栏。我可以做些什么来强制应用程序显示状态栏吗?

最佳答案

objective-c 中的一些代码,因为我只知道 objective-c

-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    // Hide the status bar
    if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)])
    {
        // iOS 7
        [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
    }
    else
    {
        // iOS 6
        [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
    }



}
- (BOOL)prefersStatusBarHidden
{
    return NO;
}

关于ios - 强制应用程序显示状态栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39485638/

相关文章:

ios - UIWebView ScrollView 内容半画

ios - 在带有消息的远程通知中显示超链接

ios - Swift:在委托(delegate)方法中使用 presentViewController 时为 "Attempt to present ViewController whose view is not in the window hierarchy"

ios - 为什么 swift 中的 var++ 是错误的,而改成 var+1 是正确的

ios - 调用抛出异常并尝试强制转换返回值的函数,如果任一失败则静默中止

ios - 在 iOS 中复制和添加 View 和内容

ios - Swift - 断言失败 -[UITableView _configureCellForDisplay :forIndexPath:]

ios - 如何将数据从模态 ViewController 传输到父 ViewController?

ios - 删除带有 CoreData 和 NSFetchedResultsController 的 UITableView 行

ios - 间歇性 SSL 错误