无法使用 xcode phonegap 在 ios 中隐藏状态栏
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15522069/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
cant hide statusbar in ios using xcode phonegap
提问by aZtraL-EnForceR
Im trying to remove the statusbar in my xcode iOS project. phonegap version 2.5. Ive tried the following.
我试图删除我的 xcode iOS 项目中的状态栏。phonegap 2.5 版。我试过以下。
1) removing statusbar from phonegap specific projects by adding the following line to config.xml
1) 通过将以下行添加到 config.xml,从 phonegap 特定项目中删除状态栏
<preference name="fullscreen" value="true" />
this is my xml file.
这是我的 xml 文件。
<?xml version="1.0" encoding="UTF-8"?>
<widget>
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="SuppressesIncrementalRendering" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="TopActivityIndicator" value="gray" />
<preference name="EnableLocation" value="false" />
<preference name="EnableViewportScale" value="true" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="FadeSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value=".25" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="AllowInlineMediaPlayback" value="false" />
<preference name="BackupWebStorage" value="cloud" />
<preference name="fullscreen" value="true" />
<content src="index.html" />
<plugins>
<plugin name="Device" value="CDVDevice" />
<plugin name="Logger" value="CDVLogger" />
<plugin name="Compass" value="CDVLocation" />
<plugin name="Accelerometer" value="CDVAccelerometer" />
<plugin name="Camera" value="CDVCamera" />
<plugin name="NetworkStatus" value="CDVConnection" />
<plugin name="Contacts" value="CDVContacts" />
<plugin name="Debug Console" value="CDVDebugConsole" />
<plugin name="Echo" value="CDVEcho" />
<plugin name="File" value="CDVFile" />
<plugin name="FileTransfer" value="CDVFileTransfer" />
<plugin name="Geolocation" value="CDVLocation" />
<plugin name="Notification" value="CDVNotification" />
<plugin name="Media" value="CDVSound" />
<plugin name="Capture" value="CDVCapture" />
<plugin name="SplashScreen" value="CDVSplashScreen" />
<plugin name="Battery" value="CDVBattery" />
<plugin name="Globalization" value="CDVGlobalization" />
<plugin name="InAppBrowser" value="CDVInAppBrowser" />
</plugins>
<access origin="*" />
</widget>
test
测试
ive also have this added to my plist file. This should remove statusbar for specific ios apps.
我也将此添加到我的 plist 文件中。这应该删除特定 ios 应用程序的状态栏。
<key>[UIApplication sharedApplication].statusBarHidden = YES;</key>
code:
代码:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>icon.png</string>
<string>[email protected]</string>
<string>icon-72.png</string>
<string>[email protected]</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>icon.png</string>
<key>CFBundleIdentifier</key>
<string>org.apache.cordova.HelloWorld</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSMainNibFile</key>
<string></string>
<key>[UIApplication sharedApplication].statusBarHidden = YES;</key>
<string>YES</string>
<key>NSMainNibFile~ipad</key>
<string></string>
</dict>
</plist>
Why is none of this working??
为什么这些都不起作用?
回答by Design by Adrian
OP is 99% correct, but you you only need to tick the box "Hide during application launch"
OP 99% 正确,但您只需要勾选“在应用程序启动期间隐藏”框
This is where you find it:
这是你找到它的地方:
Select Project Navigator (folder icon in the sidebar)
选择项目导航器(边栏中的文件夹图标)
Select the root project (the one with your project name)
选择根项目(与您的项目名称相同的项目)
Then in the main menu, highlight the Summary tab, scroll down to "Status bar"
然后在主菜单中,突出显示摘要选项卡,向下滚动到“状态栏”
回答by aZtraL-EnForceR
i fixed this finally..! I went into project properties by clicking on the project. under target / yourProject there was a statusbar menu. i selected statusbar: black translucent which fixed it.
我终于修好了..!我通过单击项目进入了项目属性。在 target / yourProject 下有一个状态栏菜单。我选择了状态栏:黑色半透明固定它。