标签:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil]; #pragma mark 监听方法 - (void)keyboardChangeFrame :(NSNotification *)note { CGFloat time = [note.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; CGRect rect = [note.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; CGFloat endY = rect.origin.y; [UIView animateWithDuration:time animations:^{ self.view.transform = CGAffineTransformMakeTranslation(0, endY - [UIScreen mainScreen].bounds.size.height); }]; }
标签:
原文地址:http://www.cnblogs.com/nielsen/p/5068116.html