gpt4 book ai didi

ios - 如何完全删除 iOS 应用程序中的 UIStatusBar?

转载 作者:行者123 更新时间:2023-11-29 02:58:40 27 4
gpt4 key购买 nike

我可以让状态栏隐藏,但应用程序仍然尊重状态栏的高度(见下图)。我还需要确保在初始加载时隐藏的状态栏没有“闪烁”,因为它会按下导航菜单按钮并在隐藏时跳回。

我尝试过的方法:

在我的主 Controller 中添加了以下内容。这个在初始加载时闪烁布局。

// hide the status bar 
ionic.Platform.fullScreen();

在 info.plist 中设置键值对

<key>UIStatusBarHidden</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>

相当于:

Status bar is initially hidden = YES
View controller-based status bar appearance = NO

尝试使用 StatusBar plugin加载中:

  .run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the status bar
if(window.StatusBar) {
StatusBar.hide();
}
});
})

尝试在我的 MainViewController.m 中设置以下内容

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];

并添加新方法

- (BOOL)prefersStatusBarHidden {
return YES;
}

我已经从 github 上尝试了大约 3 种不同的 cordova 插件。

我也是一名网络开发人员,所以在提供涉及更改 obj-c 的答案时,请像我 5 岁一样解释:

http://forum.ionicframework.com/t/how-to-hide-uistatusbar/4025

谢谢!

enter image description here

最佳答案

我在您的帖子中为您留下了评论,但这是我想出的解决方案。

你可以做的就是安装闪屏插件

 $ cordova plugin add org.apache.cordova.splashscreen

然后在您的 .run 函数中执行此操作

.run(function ($ionicPlatform, $timeout) {
$ionicPlatform.ready(function () {
// Hide the status bar
if (window.StatusBar) {
StatusBar.hide();
$timeout(function () {
window.navigator.splashscreen.hide();
}, 2500);
}
});
})

关于ios - 如何完全删除 iOS 应用程序中的 UIStatusBar?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23553220/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com