1.UIScrollView *view1;
UITextField *name;
2.添加UITextFieldDelegate
3.-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
[self.view setCenter:CGPointMake(400,100 )];
// NSTimeInterval animationDuration=0.30f;
// [UIView beginAnimations:@"ResizeForKeyboard" context:nil];
// [UIView setAnimationDuration:animationDuration];
// float width=self.view.frame.size.width;
// float height=self.view.frame.size.height;
// CGRect rect=CGRectMake(0.0f,-80,width,height);//上移80个单位,按实际情况设置
// self.view.frame=rect;
// [UIView commitAnimations];
NSLog(@" begin editing ");
return YES;
}
-(void)textFieldDidEndEditing:(UITextField *)textField
{
[self.view setCenter:CGPointMake(400, 0)];
NSLog(@" begin editing ");
}
4.设置name.delegate = self;
//去除键盘
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
[oldPwdTxt resignFirstResponder];
[newPwdTxt resignFirstResponder];
[confirmNewPwdTxt resignFirstResponder];
}