//弹出键盘偏移View
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
WS(ws);[UIView animateWithDuration:0.3 animations:^{
CGRect rect = ws.view.bounds;
rect.origin.y = 40;
ws.view.bounds = rect;
}];
return YES;
}
//收键盘
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[_longinView.zhanghaoText resignFirstResponder];
[_longinView.mimaText resignFirstResponder];
WS(ws);
[UIView animateWithDuration:0.3 animations:^{
CGRect rect = ws.view.bounds;
rect.origin.y = 0;
ws.view.bounds = rect;
}];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
[_longinView.zhanghaoText resignFirstResponder];
[_longinView.mimaText resignFirstResponder];
WS(ws);
[UIView animateWithDuration:0.3 animations:^{
CGRect rect = ws.view.bounds;
rect.origin.y = 0;
ws.view.bounds = rect;
}];
return YES;
}