//开始编辑输入框的时候,软键盘出现,执行此事件
-(void)textFieldDidBeginEditing:(UITextField *)textField{
CGRect frame = textField.frame;
int offset = frame.origin.y + 100 - (Height - 360.0);//键盘高度
NSTimeInterval animationDuration = 0.30f;
[UIView beginAnimations:@"ResizeForKeyboard" context:nil];
[UIView setAnimationDuration:animationDuration];
//将视图的Y坐标向上移动offset个单位,以使下面腾出地方用于软键盘的显示
if(offset > 0){
self.view.frame = CGRectMake(0.0f, -offset, Width, Height);
}