如何使用nativescript,angular2和Typescript更改iOS状态栏的颜色? [英] How can I change the iOS status bar color with nativescript, angular2 and typescript?
本文介绍了如何使用nativescript,angular2和Typescript更改iOS状态栏的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我找到了这个npm软件包: https://www.npmjs.com/package/nativescript-statusbar
So i've found this npm package: https://www.npmjs.com/package/nativescript-statusbar
但是我无法使用Page元素,因为我正在使用角度和打字稿.
But i'm not able to use a Page element since i'm using angular and typescript.
我已经做到了:
this.page.backgroundSpanUnderStatusBar = true;
但是我的背景颜色是黑色.
But my Background color is black.
我需要iOS上的灯光状态栏.
I would need the light status bar from iOS.
现在可以吗?
任何帮助,不胜感激!
推荐答案
您可以尝试以下
import {Component } from "angular2/core";
import frameModule = require("ui/frame");
@Component({
selector: "my-app",
template: `
<StackLayout orientation="vertical">
<Label [text]="message" class="title" (tap)="message = 'OHAI'"></Label>
</StackLayout>
`,
})
export class AppComponent {
ngOnInit() {
var page = frameModule.topmost().currentPage;
page.backgroundSpanUnderStatusBar = true;
if(page.ios){
page.ios.navBarVisibility = "always";
var controller = page.ios.controller;
var navigationBar = controller.navigationBar;
navigationBar.barStyle = 2; // different styles from 0 to 3
}
}
}
有关样式化iOS导航栏的可能性的更多信息,可以在本教程中找到
More about the possibilities of styling the iOS navigation bar you can find in this tutorial here
这篇关于如何使用nativescript,angular2和Typescript更改iOS状态栏的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文