UIViewcontroller.View
added ScrollView
.
for scrollview
i added textfields
. 5 textfields
in a row.
I want to dismiss keyboard textField.ResignFirstResponder ();
will dismiss the keyboard.
Since its scrollView
is added to view controller view View.addSubView(Scroll_View);
So, I used touchesBegan
class to dismiss keyboard.
public override void TouchesBegan (NSSet touches, UIEvent evt)
{
base.TouchesBegan (touches, evt);
UITouch touch = touches.AnyObject as UITouch;
if (touch.LocationInView (scroll_View))
{
// the touch event happened inside the UIView imgTouchMe.
textField.ResignFirstResponder ();
}
}
It shows an error:
Cannot implicitly convert type
MonoTouch.UIKit.UITouch' to
System.Drawing.Point' (CS0029) (IOS)
Is there any way I can dismiss keyboard.
@all Thanks in Advance.
public override void TouchesBegan (NSSet touches, UIEvent evt)
{
base.TouchesBegan (touches, evt);
this.View.EndEditing (true);
}
Easy way , try it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.