可以将键盘在MonoTouch.Dialog触摸细胞外被解雇? [英] Can the keyboard be dismissed by touching outside of the cell in MonoTouch.Dialog?

查看:204
本文介绍了可以将键盘在MonoTouch.Dialog触摸细胞外被解雇?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:结果
MonoTouch.Dialog:在DialogViewController


随时随地触摸键盘驳回



我注意到,触摸表格单元格(这是我想的是部分)之外时,该方法的touchesBegan不会被调用,所以我不能叫 EndEditing ResignFirstReponder



我创建一个多行条目元素;正因为如此,返回键进入到一个新的行而不是回归。这是预期的行为。不过,我也没有办法取消键盘即可。



我在设置注意到了对iPhone(常规 - >键盘 - >快捷方式)菜单或输入凭据时,即在外部区域接触不会辞职响应。这是否意味着这是iOS版的限制作为一个整体(或Apple只是没有看适合在这种情况下)?



反正有做到这一点?



还有就是,我收集,一个相同的问题,在这里,但没有人想出了一个有效的答案:

Can通过触摸DialogViewController(MonoTouch的背景解雇iPhone的键盘。对话)?



也许在一年半的人已经解决了呢?


解决方案

miguel.de.icaza回答了在不同的线程这个问题:
的http:// 。stackoverflow.com/a/10864640/1134836



他的解决方案:




  VAR自来水=新UITapGestureRecognizer(); 
tap.AddTarget(()=> {
dvc.View.EndEditing(真);
});
dvc.View.AddGestureRecognizer(TAP);



Possible Duplicate:
MonoTouch.Dialog: Dismissing keyboard by touching anywhere in DialogViewController

I noticed that when touching outside of the table cell (which I suppose is the 'section'), the touchesBegan method does not get called so I can't call EndEditing or ResignFirstReponder.

I am creating a multiline entry element; because of this, the return key goes to a new line instead of "returning". This is the intended behavior. However, I have no way to dismiss the keyboard then.

I noticed in the settings for menu on the iPhone (General->Keyboard->Shortcuts) or when entering credentials, that touching in the outer area does not resign the responder. Does this mean that this is a limitation of iOS as a whole (or Apple just didn't see fit in these instances)?

Is there anyway to do this?

There is, what I gather, an identical question here but no one came up with a valid answer:
Can I dismiss the iPhone keyboard by touching the background of DialogViewController (MonoTouch.Dialog)?

Maybe in a year and a half someone has solved it?

解决方案

miguel.de.icaza answered this question on a different thread: http://stackoverflow.com/a/10864640/1134836.

His solution:

   var tap = new UITapGestureRecognizer ();
   tap.AddTarget (() =>{
       dvc.View.EndEditing (true);
   });
   dvc.View.AddGestureRecognizer (tap);

这篇关于可以将键盘在MonoTouch.Dialog触摸细胞外被解雇?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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