标签:
[[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);
}
标签:
原文地址:http://www.cnblogs.com/fantasy3588/p/5379703.html