README.md 6.89 KB
Newer Older
李晓兵's avatar
李晓兵 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
<!---
# license: Licensed to the Apache Software Foundation (ASF) under one
#         or more contributor license agreements.  See the NOTICE file
#         distributed with this work for additional information
#         regarding copyright ownership.  The ASF licenses this file
#         to you under the Apache License, Version 2.0 (the
#         "License"); you may not use this file except in compliance
#         with the License.  You may obtain a copy of the License at
#
#           http://www.apache.org/licenses/LICENSE-2.0
#
#         Unless required by applicable law or agreed to in writing,
#         software distributed under the License is distributed on an
#         "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#         KIND, either express or implied.  See the License for the
#         specific language governing permissions and limitations
#         under the License.
-->

# cordova-plugin-statusbar

[![Build Status](https://travis-ci.org/apache/cordova-plugin-statusbar.svg)](https://travis-ci.org/apache/cordova-plugin-statusbar)

# StatusBar

> `StatusBar`Obiekt zawiera kilka funkcji, aby dostosować iOS i Android StatusBar.

## Instalacja

    cordova plugin add cordova-plugin-statusbar
    

## Preferencje

#### config.xml

  * **StatusBarOverlaysWebView** (boolean, domyślnie na wartość true). Na iOS 7 zrobić nakładki stanu lub nie nakładki widoku sieci Web podczas uruchamiania.
    
        <preference name="StatusBarOverlaysWebView" value="true" />
        

  * **StatusBarBackgroundColor** (kolor ciąg szesnastkowy, domyślnie #000000). Na iOS 7 i Android 5 kolor tła stanu przez ciąg szesnastkowy (#RRGGBB) przy starcie systemu.
    
        <preference name="StatusBarBackgroundColor" value="#000000" />
        

  * **StatusBarStyle** (stan styl paska, domyślnie lightcontent.) Na iOS 7 ustawić styl paska stanu. Dostępne opcje domyślne, lightcontent, blacktranslucent, blackopaque.
    
        <preference name="StatusBarStyle" value="lightcontent" />
        

### Dziwactwa Androida

Android 5 + wytyczne określają przy użyciu różnych kolorów statusbar niż główne aplikacji kolor (w przeciwieństwie do stanu jednolitych kolorów wiele aplikacje iOS 7 +), więc może chcesz ustawić kolor pasek stanu w czasie wykonywania zamiast za pośrednictwem `StatusBar.backgroundColorByHexString` lub `StatusBar.backgroundColorByName`. Jednym sposobem na to byłoby:

```js
if (cordova.platformId == 'android') {
    StatusBar.backgroundColorByHexString("#333");
}
```

## Przy starcie

Podczas uruchamiania można użyć funkcji StatusBar.hide poniżej, ale jeśli chcesz StatusBar ukryty w uruchamiania aplikacji, należy zmodyfikować plik Info.plist Twojej aplikacji.

Dodawanie/edycja tych dwóch atrybutów jeśli nie obecny. Ustawianie **"pasek stanu jest początkowo ukryte"** na **"Tak"** i **"Oparte na kontroler stanu paska wygląd"** na **"Nie"**. Jeśli możesz go edytować ręcznie bez Xcode, kluczy i wartości są:

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

## Metody

Ten plugin definiuje obiekt globalny `StatusBar`.

Chociaż w globalnym zasięgu, to nie dostępne dopiero po `deviceready` imprezie.

    document.addEventListener("deviceready", onDeviceReady, false);
    function onDeviceReady() {
        console.log(StatusBar);
    }
    

  * StatusBar.overlaysWebView
  * StatusBar.styleDefault
  * StatusBar.styleLightContent
  * StatusBar.styleBlackTranslucent
  * StatusBar.styleBlackOpaque
  * StatusBar.backgroundColorByName
  * StatusBar.backgroundColorByHexString
  * StatusBar.hide
  * StatusBar.show

## Właściwości

  * StatusBar.isVisible

## Uprawnienia

#### config.xml

            <feature name="StatusBar">
                <param name="ios-package" value="CDVStatusBar" onload="true" />
            </feature>
    

# StatusBar.overlaysWebView

Na iOS 7 zrobić statusbar nakładki lub nie nakładka widoku sieci Web.

    StatusBar.overlaysWebView(true);
    

## Opis

Na iOS 7 zestaw do false, aby na pasku stanu pojawia się jak iOS 6. Ustaw kolor tła i styl do korzystania z innych funkcji.

## Obsługiwane platformy

  * iOS

## Szybki przykład

    StatusBar.overlaysWebView(true);
    StatusBar.overlaysWebView(false);
    

# StatusBar.styleDefault

Użyj domyślnego stanu (ciemny tekst, teł światła).

    StatusBar.styleDefault();
    

## Obsługiwane platformy

  * iOS
  * Windows Phone 7
  * Windows Phone 8
  * Windows Phone 8.1

# StatusBar.styleLightContent

Użyj lightContent stanu (światło tekst, ciemne tło).

    StatusBar.styleLightContent();
    

## Obsługiwane platformy

  * iOS
  * Windows Phone 7
  * Windows Phone 8
  * Windows Phone 8.1

# StatusBar.styleBlackTranslucent

Użyj blackTranslucent stanu (światło tekst, ciemne tło).

    StatusBar.styleBlackTranslucent();
    

## Obsługiwane platformy

  * iOS
  * Windows Phone 7
  * Windows Phone 8
  * Windows Phone 8.1

# StatusBar.styleBlackOpaque

Użyj blackOpaque stanu (światło tekst, ciemne tło).

    StatusBar.styleBlackOpaque();
    

## Obsługiwane platformy

  * iOS
  * Windows Phone 7
  * Windows Phone 8
  * Windows Phone 8.1

# StatusBar.backgroundColorByName

Na iOS 7 gdy zostanie ustawiona wartość false, StatusBar.statusBarOverlaysWebView można ustawić kolor tła stanu przez nazwę koloru.

    StatusBar.backgroundColorByName("red");
    

Nazwy kolorów obsługiwane są:

    black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown
    

## Obsługiwane platformy

  * iOS
  * Android 5+
  * Windows Phone 7
  * Windows Phone 8
  * Windows Phone 8.1

# StatusBar.backgroundColorByHexString

Ustawia kolor tła stanu przez ciąg szesnastkowy.

    StatusBar.backgroundColorByHexString("#C0C0C0");
    

Obsługiwane są również właściwości CSS.

    StatusBar.backgroundColorByHexString("#333"); // => #333333
    StatusBar.backgroundColorByHexString("#FAB"); // => #FFAABB
    

Na iOS 7 gdy zostanie ustawiona wartość false, StatusBar.statusBarOverlaysWebView można ustawić kolor tła stanu przez ciąg szesnastkowy (#RRGGBB).

Na WP7 i WP8 można również określić wartości jako #AARRGGBB, gdzie AA jest wartością alfa

## Obsługiwane platformy

  * iOS
  * Android 5+
  * Windows Phone 7
  * Windows Phone 8
  * Windows Phone 8.1

# StatusBar.hide

Ukryj pasek stanu.

    StatusBar.hide();
    

## Obsługiwane platformy

  * iOS
  * Android
  * Windows Phone 7
  * Windows Phone 8
  * Windows Phone 8.1

# StatusBar.show

Pokazuje pasek stanu.

    StatusBar.show();
    

## Obsługiwane platformy

  * iOS
  * Android
  * Windows Phone 7
  * Windows Phone 8
  * Windows Phone 8.1

# StatusBar.isVisible

Czytać tej właściwość, aby sprawdzić, czy stanu jest widoczne lub nie.

    if (StatusBar.isVisible) {
        // do something
    }
    

## Obsługiwane platformy

  * iOS
  * Android
  * Windows Phone 7
  * Windows Phone 8
  * Windows Phone 8.1