How to dismiss number pad keyboard by tapping anywhere

后端 未结 15 2200
梦如初夏
梦如初夏 2020-12-04 17:53

I\'d like to know the simplest code to dismiss the number pad keyboard when tapping anywhere outside the number pad. It\'s a simple application to input a number inside a te

15条回答
  •  囚心锁ツ
    2020-12-04 18:05

    Just make a simple function like this one..

        -(IBAction)hideKeyboard:(id)Sender
    {
        [_textValue resignFirstResponder];
    }
    

    now go to ur nib file and connect this function with the textfield with didEndOnExit and you are good to go. Now when u will click outside ur textfield the keyboard will hide itself.

提交回复
热议问题