#pragma mark 设置弹出键盘不遮挡输入框的方法
- (void)textFieldDidBeginEditing:(UITextField *)textField {
// if (textField.tag==0) {
// [self moveView:-23];
// }
// if (textField.tag==1)
// {
// [self moveView:-40];
// }
}
- (void)textFieldDidEndEditing:(UITextField *)textField {
// if (textField.tag == 0) {
// [self moveView:23];
// }
// if (textField.tag == 1) {
// [self moveView: 40];
// }
}
-(void)moveView:(float)move{
NSTimeInterval animationDuration = 0.30f;
CGRect frame = self.view.frame;
frame.origin.y +=move;//view的X轴上移
self.view.frame = frame;
[UIViewbeginAnimations:@"ResizeView"context:nil];
[UIView setAnimationDuration:animationDuration];
self.view.frame = frame;
[UIViewcommitAnimations];//设置调整界面的动画效果
}
网友评论