Android Ionic,在iOS上保持键盘上方的按钮

Android Ionic,在iOS上保持键盘上方的按钮,android,ios,angularjs,ionic-framework,Android,Ios,Angularjs,Ionic Framework,我需要这个页面底部的“OK”按钮,以便在打开时保持在键盘上方。 它可以在Android上工作,正如你在左边的屏幕截图中看到的那样,但在IOS上不起作用(右边的屏幕截图) 你能帮我查一下密码吗 此外,正如您所看到的,“选择焦点”指令在iOS中不起作用。。。 键盘应该是iOS上的数字键盘(电话键盘),而不是 三个问题;) 下面是一段视频: 代码如下: <div class="wrapperFlex withNextButton"> <div class="itemTitle"

我需要这个页面底部的“OK”按钮,以便在打开时保持在键盘上方。 它可以在Android上工作,正如你在左边的屏幕截图中看到的那样,但在IOS上不起作用(右边的屏幕截图)

你能帮我查一下密码吗

此外,正如您所看到的,“选择焦点”指令在iOS中不起作用。。。 键盘应该是iOS上的数字键盘(电话键盘),而不是

三个问题;)

下面是一段视频:

代码如下:

<div class="wrapperFlex withNextButton">
<div class="itemTitle">
    <div class="text">
        {{'paramQuestions.weight' | translate }}
    </div>
</div>

<div id="weightdata" class="itemParameters weightdataclass row">

    <input class="weightinput" type="number" name="userweight" ng-min="{{data.minWeight}}" ng-max="{{data.maxWeight}}" ng-model="data.realWeight" ng-change="updateViewGenVol(data.weightunit, data.userweight, data.BLfactorValue);saveUserWeight()" select-on-focus required></input>
    <div class="weightunitradios">
        <ion-checkbox class="checkboxes checkbox-blueboardline" ng-model="data.weightunit" ng-true-value="'kg'" ng-false-value="'lbs'" ng-change="saveWeightUnit(); changeMinMax(); convertWeightInput(); saveUserWeight();">kg</ion-checkbox>
        <ion-checkbox class="checkboxes checkbox-blueboardline" ng-model="data.weightunit" ng-true-value="'lbs'" ng-false-value="'kg'" ng-change="saveWeightUnit(); changeMinMax(); convertWeightInput(); saveUserWeight();">lbs</ion-checkbox>
    </div>
</div>
</div>

对于键盘/滚动问题,我没有发现比此指令更好的指令(仅适用于ios):


爱奥尼亚默认情况下实际上支持此功能。查看
键盘附加
属性指令

键盘附加是一个属性指令,当键盘显示时,该指令将导致元素浮动在键盘上方。目前仅支持ion页脚栏指令


标题

来源:

要获得手机键盘,您必须使用ok,谢谢。你对其他的问题有什么想法吗?也许试试看,它似乎很管用fine@nicfo谢谢,但是这个指令对type=number不起作用,还有其他想法吗?谢谢,但是
键盘附加
在这里不起作用,因为我需要降低视图的高度,如果我
将所有东西都附加到键盘上,结局不好!伙计,请从模板中添加一个使用此指令的示例。什么是授权处理?谢谢
.directive('selectOnFocus', function ($timeout) {
  return {
      restrict: 'A',
      link: function (scope, element, attrs) {
          var focusedElement = null;

          element.on('focus', function () {
              var self = this;
              if (focusedElement != self) {
                  focusedElement = self;
                  $timeout(function () {
                      self.select();
                  }, 10);
              }
          });

          element.on('blur', function () {
              focusedElement = null;
          });
        }
  }
})
.directive('keyboardResize', function ($ionicScrollDelegate) {
      return {
        restrict: 'A',
        link: function postLink(scope, element, attrs) {

            function onKeyboardShow (e) {
                element.css('bottom', e.keyboardHeight + 'px');
                $ionicScrollDelegate.$getByHandle(attrs.delegateHandle).resize();
                console.log("ouiaaaaaaaaa")
            };
            function onKeyboardHide (e) {
                element.css('bottom', '');
                $ionicScrollDelegate.$getByHandle(attrs.delegateHandle).resize();
            };

            if (ionic.Platform.isIOS()) {
              ionic.on('native.keyboardshow', onKeyboardShow, window);
              ionic.on('native.keyboardhide', onKeyboardHide, window);

              scope.$on('$destroy', function () {
                  ionic.off('native.keyboardshow', onKeyboardShow, window);
                  ionic.off('native.keyboardhide', onKeyboardHide, window);
              });
            }

        }
      }
    })      
<ion-footer-bar align-title="left" keyboard-attach class="bar-assertive">
   <h1 class="title">Title!</h1>
</ion-footer-bar>