[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyBoardFrameChange:) name:UIKeyboardWillChangeFrameNotification object:nil];
#pragma mark 通知的方法
- (void)keyBoardFrameChange:(NSNotification *)userInfo
{
NSLog(@"userInfo == %@",userInfo.userInfo);
// 取得键盘的Y值
CGRect rectValue = [userInfo.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGFloat keyBoardY = rectValue.origin.y;
CGFloat keyBoardTransform = keyBoardY - self.view.frame.size.height;
self.view.transform = CGAffineTransformMakeTranslation(0, keyBoardTransform);
}