将Ionic 3应用程序的iOS状态栏字体颜色更改为白色
my config.xml将Ionic 3应用程序的iOS状态栏字体颜色更改为白色,ios,ionic-framework,ionic2,ionic3,Ios,Ionic Framework,Ionic2,Ionic3,my config.xml <preference name="StatusBarOverlaysWebView" value="true" /> <preference name="StatusBarStyle" value="lightcontent" /> 这没用 如果您没有用于状态栏的ng cordova插件。那么你可以这样做- .run(function($ionicPlatform) { $ionicPlatform.ready(function() {
<preference name="StatusBarOverlaysWebView" value="true" />
<preference name="StatusBarStyle" value="lightcontent" />
这没用 如果您没有用于状态栏的ng cordova插件。那么你可以这样做-
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
也许你可以在你的平台上试试这个。ready()。然后(()=>方法
StatusBar.overlyswebview(false);
StatusBar.backgroundColorByHexString(“#00FFFF”);
我找到了解决方案。它对我很有用
statusBar.overlaysWebView(true);
statusBar.backgroundColorByHexString('#1f2933');
在我的例子中,我需要在IOS中更改状态栏背景颜色和内容颜色 首先,我需要安装插件。
ionic cordova plugin add cordova-plugin-statusbar
npm install --save @ionic-native/status-bar@4 // version 4 since ionic 3
然后在app.com.ts中
constructor(statusBar: StatusBar, platform: Platform) {
platform.ready().then(() => {
statusBar.overlaysWebView(false);
// overlaysWebView must set to false if you change the background color in iOS with ionic (hence I am using backgroundColorByHexString method )
statusBar.backgroundColorByHexString('#c8102e');
// used above hex color code to set the status bar background color
statusBar.styleLightContent();
// above function will change the status bar content (icon , text)
statusBar.show();
// finally shows the status bar
});
}
最后我得到了我需要的
ionic 1和styleDefault()的代码对我不起作用
ionic cordova plugin add cordova-plugin-statusbar
npm install --save @ionic-native/status-bar@4 // version 4 since ionic 3
constructor(statusBar: StatusBar, platform: Platform) {
platform.ready().then(() => {
statusBar.overlaysWebView(false);
// overlaysWebView must set to false if you change the background color in iOS with ionic (hence I am using backgroundColorByHexString method )
statusBar.backgroundColorByHexString('#c8102e');
// used above hex color code to set the status bar background color
statusBar.styleLightContent();
// above function will change the status bar content (icon , text)
statusBar.show();
// finally shows the status bar
});
}