How to hide number pad, I'm use Xamarin iOS (C#) -
i'm found answer question on objective-c, i'm don't search in xamarin ios. have field user write phone number, when field editing appear keyboard, number pad type. keyboard don't hide , don't have hide button.
in android application problem use code:
one.click += delegate { inputmethodmanager imm = (inputmethodmanager)getsystemservice(context.inputmethodservice); imm.hidesoftinputfromwindow(ulitsa.windowtoken, 0); };
in ios app code don't work. code in ios:
tel.shouldreturn = delegate { tel.resignfirstresponder (); //tel.returnkeytype = uireturnkeytype.done; return true; };
this code work default keyboard type. in keyboard type number pad have result in screenshot:
how can solve problem?
you can see blog. might lot.
public override void viewdidload () { base.viewdidload (); // stuff nsnotificationcenter.defaultcenter.addobserver ("uikeyboardwillshownotification", keyboardwillshow); } public void keyboardwillshow(nsnotification notification) { var donebutton = new uibutton (uibuttontype.custom); donebutton.frame = new rectanglef (0, 163, 106, 53); donebutton.settitle ("done", uicontrolstate.normal); donebutton.settitlecolor (uicolor.black, uicontrolstate.normal); donebutton.settitlecolor (uicolor.white, uicontrolstate.highlighted); donebutton.touchupinside += (sender, e) => { // make done button thing! textfield shouldn't first responder _txtnumbers.resignfirstresponder(); }; // 'magic' change future version of ios var keyboard = _txtnumbers.weakinputdelegate uiview; if (keyboard != null) { keyboard.addsubview (donebutton); } }
or can code
this.view.endediting(true);
Comments
Post a Comment