OGeek|极客世界-中国程序员成长平台

标题: html - 在 iOS 上为 Ionic 中的两个键盘腾出空间 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 15:08
标题: html - 在 iOS 上为 Ionic 中的两个键盘腾出空间

所以我在 Ionic View 的页脚中有一个标签栏和一个输入,如下图所示:

enter image description here

但是当我单击底部的输入字段时,似乎为两个键盘留出了空间,如下所示:

enter image description here

我可以在输入字段下方的空间中滚动以将其放回应有的位置,但我不知道如何将其放回原处。

这是选项卡和 View 的代码:

    <ion-tabs class="tabs-icon-top">
        <ion-tab title="Tab 1" icon="ion-ionic">
            <ion-nav-view name="tab-one">
                <ion-content>
                    <h1>Header 1</h1>
                    <h2>Header 2</h2>
                    <h3>Header 3</h3>
                </ion-content>
                <ion-footer-bar keyboard-attach class="bar-stable item-input-inset">
                    <label class="item-input-wrapper">
                        <input type="text" placeholder="Type your message">
                    </label>
                    <button class="button button-clear">Send</button>
                </ion-footer-bar>
            </ion-nav-view>
        </ion-tab>
        <ion-tab title="Tab 2" icon="ion-ionic">
            <ion-nav-view name="tab-two">
                2
            </ion-nav-view>
        </ion-tab>
        <ion-tab title="Tab 3" icon="ion-ionic">
            <ion-nav-view name="tab-three">
                3
            </ion-nav-view>
        </ion-tab>
    </ion-tabs>

我在没有使用 keyboard-attach 的情况下尝试过,但它会将屏幕上半部分的所有内容(包括导航栏,如果有的话)推离我的屏幕不想发生。

所以基本上我希望输入字段在选择时位于键盘正上方,并且内容不会被推离页面顶部。

非常感谢任何帮助!

ionic 版本:1.3.20

Cordova 版本:4.3.0

Xcode 版本:6.3



Best Answer-推荐答案


将这个添加到 app.js 中的 run 函数解决了我的问题

cordova.plugins.Keyboard.disableScroll(true);

关于html - 在 iOS 上为 Ionic 中的两个键盘腾出空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29846816/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4