菜鸟教程小白 发表于 2022-12-12 15:31:57

ios - 如何在 iOS 上制作 Meteor Cordova *NOT* 全屏?


                                            <p><p>我使用 Cordova for iOS 运行/构建我的 Meteor Web 应用程序。不幸的是,我得到一个覆盖顶部状态栏(包括运营商、时间、电池等)的全屏应用程序。我试图避免它 - 有一个常规(即非全屏)应用程序。</p>

<p>我已明确将全屏首选项设置为 false:</p>

<pre><code>App.setPreference(&#39;Fullscreen&#39;, false);
</code></pre>

<p>但应用仍然会占用 100% 的屏幕高度。如果重要的话,我也在使用 ionic 。 </p>

<p>有什么想法吗? </p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>这由 <a href="https://github.com/apache/cordova-plugin-statusbar" rel="noreferrer noopener nofollow">status bar plugin</a> 处理:</p>

<pre><code>App.setPreference(&#34;StatusBarOverlaysWebView&#34;, false);
</code></pre>

<p>因此,如果您将此设置为 false,则 WebView 将不再覆盖状态栏,也不会是“全屏”。</p>

<p>您还有其他一些偏好来控制状态栏的颜色。来自状态栏插件文档:</p>

<blockquote>
<p><strong>StatusBarBackgroundColor</strong> (color hex string, no default value). On iOS
7, set the background color of the statusbar by a hex string (#RRGGBB)
at startup. If this value is not set, the background color will be
transparent.</p>

<p><code>&lt;preference name=&#34;StatusBarBackgroundColor&#34; value=&#34;#000000&#34; /&gt;</code></p>

<p><strong>StatusBarStyle</strong> (status bar style, defaults to lightcontent). On iOS 7,
set the status bar style. Available options default, lightcontent,
blacktranslucent, blackopaque.</p>

<p><code>&lt;preference name=&#34;StatusBarStyle&#34; value=&#34;lightcontent&#34; /&gt;</code></p>
</blockquote>

<p>针对 Cordova 的文档和 Meteor 之间的唯一区别是首选项是使用 <code>mobile-config.js</code> 文件中的 <code>App.setPreference</code> 而不是 <code><首选项名称=...</code>。在 <code>config.xml</code></p>

<p>如果您 <a href="https://github.com/meteor/meteor/wiki/Meteor-Cordova-Phonegap-integration#advanced-build-customization" rel="noreferrer noopener nofollow">build your own config.xml</a>,则可以使用 Cordova 表示法但这不是必需的,因为 Meteor 表示法能够将这些传递给它在后台为您构建的 <code>config.xml</code>。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何在 iOS 上制作 Meteor Cordova *NOT* 全屏?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/30961284/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/30961284/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何在 iOS 上制作 Meteor Cordova *NOT* 全屏?