arnaucube
arnaucube/commonroutesServerPublic Self-hosted repository
commonroutesServer/www/plugins/cordova-plugin-statusbar/doc/zh/index.md
www/plugins/cordova-plugin-statusbar/doc/zh/index.mdRaw
  1<!---
  2    Licensed to the Apache Software Foundation (ASF) under one
  3    or more contributor license agreements.  See the NOTICE file
  4    distributed with this work for additional information
  5    regarding copyright ownership.  The ASF licenses this file
  6    to you under the Apache License, Version 2.0 (the
  7    "License"); you may not use this file except in compliance
  8    with the License.  You may obtain a copy of the License at
  9
 10      http://www.apache.org/licenses/LICENSE-2.0
 11
 12    Unless required by applicable law or agreed to in writing,
 13    software distributed under the License is distributed on an
 14    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15    KIND, either express or implied.  See the License for the
 16    specific language governing permissions and limitations
 17    under the License.
 18-->
 19
 20# cordova-plugin-statusbar
 21
 22# StatusBar
 23
 24> `StatusBar`物件提供了一些功能,自訂的 iOS 和 Android 狀態列。
 25
 26## 安裝
 27
 28    cordova plugin add cordova-plugin-statusbar
 29    
 30
 31## 首選項
 32
 33#### config.xml
 34
 35*   **StatusBarOverlaysWebView**(布林值,預設值為 true)。在 iOS 7,使狀態列覆蓋或不覆蓋 web 視圖在啟動時。
 36    
 37        <preference name="StatusBarOverlaysWebView" value="true" />
 38        
 39
 40*   **StatusBarBackgroundColor**(顏色十六進位字串,預設值為 #000000)。在 iOS 7,通過一個十六進位字串 (#RRGGBB) 在啟動時設置狀態列的背景色。
 41    
 42        <preference name="StatusBarBackgroundColor" value="#000000" />
 43        
 44
 45*   **狀態列**(狀態列樣式,預設值為 lightcontent)。在 iOS 7,設置的狀態橫條圖樣式。可用的選項預設,lightcontent,blacktranslucent,blackopaque。
 46    
 47        <preference name="StatusBarStyle" value="lightcontent" />
 48        
 49
 50## 在啟動時隱藏
 51
 52在運行時期間,你可以使用 StatusBar.hide 函數下面,但如果你想要顯示狀態列隱藏在應用程式啟動時,你必須修改你的應用程式的 Info.plist 檔。
 53
 54添加編輯這兩個屬性,如果不存在。 將**"狀態列最初隱藏"**設置為**"YES"**和**"視圖基於控制器的狀態列外觀"**設置為**"否"**。 如果您手動編輯它沒有 Xcode,鍵和值是:
 55
 56    <key>UIStatusBarHidden</key>
 57    <true/>
 58    <key>UIViewControllerBasedStatusBarAppearance</key>
 59    <false/>
 60    
 61
 62## 方法
 63
 64這個外掛程式定義全域 `StatusBar` 物件。
 65
 66雖然在全球範圍內,它不可用直到 `deviceready` 事件之後。
 67
 68    document.addEventListener("deviceready", onDeviceReady, false);
 69    function onDeviceReady() {
 70        console.log(StatusBar);
 71    }
 72    
 73
 74*   StatusBar.overlaysWebView
 75*   StatusBar.styleDefault
 76*   StatusBar.styleLightContent
 77*   StatusBar.styleBlackTranslucent
 78*   StatusBar.styleBlackOpaque
 79*   StatusBar.backgroundColorByName
 80*   StatusBar.backgroundColorByHexString
 81*   StatusBar.hide
 82*   StatusBar.show
 83
 84## 屬性
 85
 86*   StatusBar.isVisible
 87
 88## 許可權
 89
 90#### config.xml
 91
 92            <feature name="StatusBar">
 93                <param name="ios-package" value="CDVStatusBar" onload="true" />
 94            </feature>
 95    
 96
 97# StatusBar.overlaysWebView
 98
 99在 iOS 7,使狀態列覆蓋或不覆蓋 web 視圖。
100
101    StatusBar.overlaysWebView(true);
102    
103
104## 說明
105
106在 iOS 7,設置為 false,使狀態列出現像 iOS 6。設置樣式和背景顏色,適合使用其他函數。
107
108## 支援的平臺
109
110*   iOS
111
112## 快速的示例
113
114    StatusBar.overlaysWebView(true);
115    StatusBar.overlaysWebView(false);
116    
117
118# StatusBar.styleDefault
119
120使用預設狀態列 (淺色背景深色文本)。
121
122    StatusBar.styleDefault();
123    
124
125## 支援的平臺
126
127*   iOS
128*   Windows Phone 7
129*   Windows Phone 8
130*   Windows Phone 8.1
131
132# StatusBar.styleLightContent
133
134使用 lightContent 狀態列 (深色背景光文本)。
135
136    StatusBar.styleLightContent();
137    
138
139## 支援的平臺
140
141*   iOS
142*   Windows Phone 7
143*   Windows Phone 8
144*   Windows Phone 8.1
145
146# StatusBar.styleBlackTranslucent
147
148使用 blackTranslucent 狀態列 (深色背景光文本)。
149
150    StatusBar.styleBlackTranslucent();
151    
152
153## 支援的平臺
154
155*   iOS
156*   Windows Phone 7
157*   Windows Phone 8
158*   Windows Phone 8.1
159
160# StatusBar.styleBlackOpaque
161
162使用 blackOpaque 狀態列 (深色背景光文本)。
163
164    StatusBar.styleBlackOpaque();
165    
166
167## 支援的平臺
168
169*   iOS
170*   Windows Phone 7
171*   Windows Phone 8
172*   Windows Phone 8.1
173
174# StatusBar.backgroundColorByName
175
176在 iOS 7,當您將 StatusBar.statusBarOverlaysWebView 設置為 false,你可以設置狀態列的背景色的顏色名稱。
177
178    StatusBar.backgroundColorByName("red");
179    
180
181支援的顏色名稱是:
182
183    black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown
184    
185
186## 支援的平臺
187
188*   iOS
189*   Windows Phone 7
190*   Windows Phone 8
191*   Windows Phone 8.1
192
193# StatusBar.backgroundColorByHexString
194
195由十六進位字串設置狀態列的背景色。
196
197    StatusBar.backgroundColorByHexString("#C0C0C0");
198    
199
200此外支援 CSS 速記屬性。
201
202    StatusBar.backgroundColorByHexString("#333"); // => #333333
203    StatusBar.backgroundColorByHexString("#FAB"); // => #FFAABB
204    
205
206在 iOS 7,當將 StatusBar.statusBarOverlaysWebView 設置為 false,您可以設置狀態列的背景色由十六進位字串 (#RRGGBB)。
207
208WP7 和 WP8 您還可以指定值為 #AARRGGBB,其中 AA 是 Alpha 值
209
210## 支援的平臺
211
212*   iOS
213*   Windows Phone 7
214*   Windows Phone 8
215*   Windows Phone 8.1
216
217# StatusBar.hide
218
219隱藏狀態列。
220
221    StatusBar.hide();
222    
223
224## 支援的平臺
225
226*   iOS
227*   安卓系統
228*   Windows Phone 7
229*   Windows Phone 8
230*   Windows Phone 8.1
231
232# StatusBar.show
233
234顯示狀態列。
235
236    StatusBar.show();
237    
238
239## 支援的平臺
240
241*   iOS
242*   安卓系統
243*   Windows Phone 7
244*   Windows Phone 8
245*   Windows Phone 8.1
246
247# StatusBar.isVisible
248
249讀取此屬性,以查看狀態列是否可見。
250
251    if (StatusBar.isVisible) {
252        // do something
253    }
254    
255
256## 支援的平臺
257
258*   iOS
259*   安卓系統
260*   Windows Phone 7
261*   Windows Phone 8
262*   Windows Phone 8.1