开发者

hiding the keypad on iphone

I have a for开发者_运维问答m that looks like the following (see image). If the user hits the Login button, I want the keypad to disappear. How do I do that.

Note that TextFieldDelegate methods wouldnt get called since the user is simply hitting the UIButton (Login). Hence, anything I can put in the IBAction for this button?

hiding the keypad on iphone


Normally the keyboard should be dismissed automatically when the user taps somewhere outside of the textfield, but you can also manually hide it using

[textField resignFirstResponder]


 set delegate for your text field <UITextFieldDelegate>
 and over ride this method

-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
   [textField resignFirstResponder];
    return YES;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜