通过使用angular2 / nativescript,仍然可以在某些页面上更改状态栏颜色吗?
我试图从文档中使用这种方式,但是它不起作用。
import { topmost } from "tns-core-modules/ui/frame";
if (topmost().ios) {
var navigationBar = topmost().ios.controller.navigationBar;
// 0: default
// 1: light
navigationBar.barStyle = 1;
}
操场示例在这里:https://play.nativescript.org/?template=play-ng&id=z8CnAz
PS:我需要在第一页上显示黑色状态栏,在第二页上显示白色。有可能吗?
答案 0 :(得分:0)
您必须在<?php
session_start();
$Nom = $_POST["Nom"];
$mdp = $_POST["mdp"];
//$id_role = $_POST["id_role"];
try{
$bdd = new PDO('mysql:host=localhost;dbname=azer', 'root', '', array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
} catch (Exception $e) {
die("acces imlpossible");
}
$st = $bdd->query("SELECT * FROM membre WHERE Nom='".$Nom."'")->fetch();
$mangetesmorts = $bdd->query("SELECT * FROM membre WHERE id_role");
if (password_verify($mdp, $st['mdp'])) {
$_SESSION['Nom'] = $Nom;
$_SESSION['activite'] = $st['activite'];
//$_SESSION['id_role'] = $mangetesmorts['id_role'];
//var_dump($_SESSION['id_role']);
//print_r($id_role);
while ($donne = $mangetesmorts->fetch()) {
$_SESSION['id_role']=$donne['id_role'];
if ($_SESSION['activite'] =='cricket') {
header("Location: cricket.php");
} elseif ($_SESSION['activite'] == 'foot') {
header("Location: foot.php");
} elseif ($_SESSION['id_role'] == 2) {
header("Location: admin.php");
} elseif ($_SESSION['id_role'] == 1) {
header("Location: admin_super.php");
} else {
header("Location: index2.php");
}
}
}
中将df = [[1,'CAT1',10], [2, 'CAT1', 11], [3, 'CAT2', 20], [4, 'CAT2', 22], [5, 'CAT3', 30]]
df = spark.createDataFrame(df, ['id', 'category', 'consumption'])
df.show()
+---+--------+-----------+
| id|category|consumption|
+---+--------+-----------+
| 1| CAT1| 10|
| 2| CAT1| 11|
| 3| CAT2| 20|
| 4| CAT2| 22|
| 5| CAT3| 30|
+---+--------+-----------+
键设置为df.groupby('category').agg(F.sum('consumption').alias('sum_'))
).withColumn("normalized", F.col("consumption")/F.col("sum_"))\
.show()
+---+--------+-----------+--------+----+-------------------+
| id|category|consumption|category|sum_| normalized|
+---+--------+-----------+--------+----+-------------------+
| 1| CAT1| 10| CAT2| 42|0.23809523809523808|
| 2| CAT1| 11| CAT2| 42| 0.2619047619047619|
| 1| CAT1| 10| CAT1| 21|0.47619047619047616|
| 2| CAT1| 11| CAT1| 21| 0.5238095238095238|
| 1| CAT1| 10| CAT3| 30| 0.3333333333333333|
| 2| CAT1| 11| CAT3| 30|0.36666666666666664|
| 3| CAT2| 20| CAT2| 42|0.47619047619047616|
| 4| CAT2| 22| CAT2| 42| 0.5238095238095238|
| 5| CAT3| 30| CAT2| 42| 0.7142857142857143|
| 3| CAT2| 20| CAT1| 21| 0.9523809523809523|
| 4| CAT2| 22| CAT1| 21| 1.0476190476190477|
| 5| CAT3| 30| CAT1| 21| 1.4285714285714286|
| 3| CAT2| 20| CAT3| 30| 0.6666666666666666|
| 4| CAT2| 22| CAT3| 30| 0.7333333333333333|
| 5| CAT3| 30| CAT3| 30| 1.0|
+---+--------+-----------+--------+----+-------------------+
UIViewControllerBasedStatusBarAppearance
答案 1 :(得分:0)
您可以使用下一个处理程序将加载事件设置为ActionBar
:
export function onActionBarLoaded(args: EventData) {
const actionBar = <ActionBar>args.object;
if (actionBar.ios) {
var navigationBar = actionBar.page.frame.ios.controller.navigationBar;
navigationBar.barStyle = 1;
}
}