UIButton类型为 UIButtonTypeCustom, 添加一个方法
[button addTarget:self action:@selector(hideKeyboard) forControlEvents:UIControlEventTouchUpInside];
方法一
-(void)hideKeyboard
{
[myTextfield resignFirstResponder];
}
方法二
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[_userNumber resignFirstResponder];
[_userPassword resignFirstResponder];
}