你的位置:首页 > 操作系统

[操作系统]//视图跟着键盘推出一起动


 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardwasChange:) name:UIKeyboardWillChangeFrameNotification object:nil];

 

- (void)keyboardwasChange:(NSNotification *)info

{

    CGRect keyFrame = [info.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];

    CGFloat tY = keyFrame.origin.y - self.view.frame.size.height - 64;

    

    self.view.transform = CGAffineTransformMakeTranslation(0, tY);

}