MonoTouch.Dialog:关闭键盘 [英] MonoTouch.Dialog: Dismissing a Keyboard

查看:38
本文介绍了MonoTouch.Dialog:关闭键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用反射 API 自动生成用户界面.

Using the Reflection API to auto generate a UI.

当用户选择一个新字段,或者如果他们选择一个生成新视图供选择的字段时,我如何关闭键盘.在后一种情况下,当用户返回到第一个屏幕时,旧键盘仍然存在.

How can I dismiss the keyboard when the user selects a new field, or if they choose a field which generates a new view to pick from. In the later case, when the user returns to the first screen, the old keyboard is still there.

推荐答案

UIView.EndEditing(bool force);

以上将为您隐藏键盘,而无需知道第一响应者是谁.我对反射 API 没有做太多,但是您应该能够在选择元素时在视图上调用它.

The above will hide the keyboard for you without needing to know who the first responder is. I haven't done much with the reflection API but you should be able to call that on the view when an element is selected.

Apple 文档 -- 结束

这篇关于MonoTouch.Dialog:关闭键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆