#pragma mark➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖注册通知
-(void)viewWillAppear:(BOOL)animated{
//键盘将弹出的时候获取通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyBoardWillShow:) name:UIKeyboardWillShowNotification object:nil];
//键盘将隐藏的时候获取通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyBoardWillHidden:) name:UIKeyboardWillHideNotification object:nil];
//键盘将弹出的时候获取通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyBoardWillShow:) name:UIKeyboardWillShowNotification object:nil];
//键盘将隐藏的时候获取通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyBoardWillHidden:) name:UIKeyboardWillHideNotification object:nil];
}
#pragma mark➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖键盘显示
-(void)keyBoardWillShow:(NSNotification
*)notifi{
[UIView beginAnimations:@"" context:@""];
[UIView setAnimationCurve:7];
[UIView setAnimationDuration:0.25];
CGRect r = self.view.frame;
r.origin.y = -186; //网上移的逻辑点
self.view.frame = r;
[UIView beginAnimations:@"" context:@""];
[UIView setAnimationCurve:7];
[UIView setAnimationDuration:0.25];
CGRect r = self.view.frame;
r.origin.y = -186; //网上移的逻辑点
self.view.frame = r;
}
#pragma mark➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖键盘隐藏
-(void)keyBoardWillHidden:(NSNotification
*)notifi{
[UIView beginAnimations:@"" context:@""];
[UIView setAnimationCurve:7];
[UIView setAnimationDuration:0.25];
CGRect r = self.view.frame;
r.origin.y = 0;
self.view.frame = r;
[UIView beginAnimations:@"" context:@""];
[UIView setAnimationCurve:7];
[UIView setAnimationDuration:0.25];
CGRect r = self.view.frame;
r.origin.y = 0;
self.view.frame = r;
}