【问题标题】:Cannot dismiss keyboard from UIPopover in monotouch无法在单点触控中从 UIPopover 关闭键盘
【发布时间】:2012-11-19 16:07:14
【问题描述】:

我无法从 UIPopover 中关闭键盘。当我运行这个ResignFirstResponder() 函数时,我有弹出框形式的文本字段,没有任何反应。不知道为什么有任何想法。只有当我从弹出窗口运行它时才会发生。

是不是因为它叠加和对象。需要帮助吗?

这是我的代码的一些示例: 这里我叫popover;

            if (this.CustomerID != 0) {
                var content = new BillingAddressViewController (this, this.CustomerBillingAddress);
                content.CustomerID = this.CustomerID;
                content.rootcontroller = this;
                DetailViewPopover = new UIPopoverController (content);
                DetailViewPopover.PopoverContentSize = new SizeF (300, 200);
                DetailViewPopover.PresentFromRect (this.customerBillingAddressCell.Frame, View, UIPopoverArrowDirection.Any, true);
            } else {
                var x = new UIAlertView ("Notifcation Message", "Please choose customer to proceed with Billing Address", null, "OK");
                x.Show ();
            }

        };

我正在调用的弹出内容类内部

this.billingTextView.ResignFirstResponder();

按钮触发;

【问题讨论】:

    标签: ios xamarin.ios textfield uipopover


    【解决方案1】:

    在您的 DissmisskeyBoard 方法中使用以下代码。

    [self.view endEditing:YES];
    

    希望对你有所帮助。

    - (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [self.view endEditing:YES];
    return YES;
    }
    

    【讨论】:

    • 它是否在复制任何内容。我在 rootview 和 popover 视图中都调用了这个函数
    • 你在.h文件中使用过UITextfieldDelegate,在.m文件中使用过textfield.delegate=self吗?
    • 尝试编辑您的问题并发布一些代码,然后很容易找到问题。
    • 我不明白为什么当我从根控制器调用它时我没有遇到这种问题。
    • 嗨,我发现了问题。这是因为segue。一旦我从一个视图转到另一个视图并再次返回上一页。它停止运行不知道为什么但这是问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-04
    • 1970-01-01
    • 1970-01-01
    • 2011-06-11
    • 2020-02-24
    相关资源
    最近更新 更多