【问题标题】:Sencha touch datepicker and ios soft keyboardSencha touch datepicker 和 ios 软键盘
【发布时间】:2013-06-13 06:54:19
【问题描述】:

我有一个包含几个文本字段和一个日期选择器字段的字段集。

一切正常,除非文本字段处于焦点且 ios 键盘处于视图中。如果我单击键盘顶部的下一个(或后退)按钮,然后单击日期选择器,而不是将日期选择器停靠在屏幕底部,它会飞到中间的某个位置。我猜这是由于键盘将 webview 向上推,而 datepicker 仍试图停靠到现在位于屏幕一半的底部。

这发生在模拟器(见屏幕截图)和我的设备上。

有什么解决方法吗?我可以延迟日期选择器的弹出,直到键盘放回原位?

顺便说一句,Sencha Touch 选择字段也会发生这种情况

【问题讨论】:

    标签: sencha-touch-2


    【解决方案1】:

    您可以更新选择器组件代码:

    touch/src/picker/Date.js:

    /**
     * Update by ZWD/gloot
     * Date: 7/30/2013
     */
    onDoneButtonTap: function() {
        var me = this;
        var oldValue = this._value,
            newValue = this.getValue(true),
            testValue = newValue;
    
        if (Ext.isDate(newValue)) {
            testValue = newValue.toDateString();
        }
        if (Ext.isDate(oldValue)) {
            oldValue = oldValue.toDateString();
        }
    
        if (testValue != oldValue) {
            this.fireEvent('change', this, newValue);
        }
    
        setTimeout(function() {
            me.hide();
            me.inputBlocker.unblockInputs();
        }, 300);
    
        Ext.hideKeyboard();
    }
    

    和picker/Picker.js

    /**
     * @private
     * Called when the done button has been tapped.
     * Update by ZWD/gloot
     * Date: 7/30/2013
     */
    onDoneButtonTap: function() {
        var me = this, oldValue = me._value,
            newValue = me.getValue(true);
    
        if (newValue != oldValue) {
            me.fireEvent('change', me, newValue);
        }
    
        setTimeout(function() { 
            me.hide();
            me.inputBlocker.unblockInputs();
        }, 300);
    
    },
    
    /**
     * @private
     * Called when the cancel button has been tapped.
     * Update by ZWD/gloot
     * Date: 7/30/2013
     */
    onCancelButtonTap: function() {
        var me = this;
        me.fireEvent('cancel', me);
    
        setTimeout(function() {
            me.hide();
            me.inputBlocker.unblockInputs();
        }, 300);
    }
    

    /////////////////////////////////////// ///////

    the setTimeout method can solve the question!
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多