【问题标题】:Cordova plugin Datepicker popup, displayed in wrong position on iPadCordova 插件 Datepicker 弹出窗口,在 iPad 上显示在错误的位置
【发布时间】:2014-10-10 09:38:32
【问题描述】:

我们有一个 Cordova 项目 (3.6.3),并且(由于各种原因我不想在这里讨论)我们必须从这里包含日期选择器插件:
https://github.com/sectore/phonegap3-ios-datepicker-plugin
iPhone 上一切正常,但 iPad 带来了奇怪的行为

首先 - 当我单击日期输入字段的标签时,它不会删除本机日期选择器(当我单击输入本身时它会删除它)。
其次 - 它在视口的错误位置显示插件日期选择器(左上角,而不是在日期输入字段上方,作为本机)。

有没有人遇到过这样的问题,也许你知道是什么导致了插件的这种奇怪行为?

欢呼

【问题讨论】:

  • 你有没有找到解决这个问题的方法?我遇到了同样的问题,但使用了更新版本的 datepicker 插件。我在文档中看到它支持 X 和 Y 配置,但这仅用于相对于应用程序的根视图绝对定位选择器,而不是直接位于选择器下方。
  • 如果我没记错的话,我们最终使用了本地日期选择器。所以真的帮不上这个忙。看起来在这种特殊情况下,出于某种原因,我们从未取消本机日期选择器,但我从未深入了解这个问题,因为它已经“解决了自己”;)

标签: ios ipad cordova datepicker


【解决方案1】:

关于这个问题你可以显示iPhone的日期选择器

让我们看看代码 首先在此函数中,您需要注释 iphone 的特殊情况以使其成为一般情况

(void)show:(CDVInvokedUrlCommand*)command {
    _command = command;
  NSMutableDictionary *options = [command argumentAtIndex:0];
  //if (isIPhone) {
    [self showForPhone: options];
  //} else {
   // [self showForPad: options];
  //}
}

别忘了去掉隐藏的特殊处理

(void)hide {
  //if (isIPhone) {
    CGRect frame = CGRectOffset(self.datePickerComponentsContainer.frame,
                                0,
                                self.datePickerComponentsContainer.frame.size.height);

    [UIView animateWithDuration:ANIMATION_DURATION
                          delay:0
                        options:UIViewAnimationOptionCurveEaseOut
                     animations:^{
                       self.datePickerComponentsContainer.frame = frame;
                       self.datePickerContainer.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0];

                     } completion:^(BOOL finished) {
                       [self.datePickerContainer removeFromSuperview];
                     }];

 // } else {
  //  [self.datePickerPopover dismissPopoverAnimated:YES];
 // }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多