We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当文本框成为第一响应者后,有可能多次接收到UIKeyboardWillChangeFrameNotification通知, 在通知处理方法(keyboardWillChangeFrame:)中,设置_popupView.center的Y值是根据当前Y值计算出来的,建议通过获取键盘前后位置差值来设置_popupView.center。
// if (!CGPointEqualToPoint(CGPointZero, _markerCenter)) { // _popupView.center = CGPointMake(_markerCenter.x, _markerCenter.y - changeHeight); // } else { // _popupView.center = CGPointMake(_popupView.center.x, _popupView.center.y - changeHeight); // }
CGRect beginKeyboardRect = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue]; CGRect endKeyboardRect = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; CGFloat yOffset = endKeyboardRect.origin.y - beginKeyboardRect.origin.y; _popupView.center = CGPointMake(_popupView.center.x, _popupView.center.y + yOffset - self.offsetSpacingOfKeyboard);
The text was updated successfully, but these errors were encountered:
没看明白
Sorry, something went wrong.
if (!CGPointEqualToPoint(CGPointZero, _markerCenter)) { _popupView.center = CGPointMake(_markerCenter.x, _markerCenter.y - changeHeight); } else { if ([self finishedCenter].y == _popupView.center.y) { //判断当前位置是否已经移动过。 _popupView.center = CGPointMake(_popupView.center.x, _popupView.center.y - changeHeight); } } 我这么改了下,目前还没发现问题,确实是,通知被调用了两次
谢谢,试了试是可以的
No branches or pull requests
当文本框成为第一响应者后,有可能多次接收到UIKeyboardWillChangeFrameNotification通知,
在通知处理方法(keyboardWillChangeFrame:)中,设置_popupView.center的Y值是根据当前Y值计算出来的,建议通过获取键盘前后位置差值来设置_popupView.center。
// if (!CGPointEqualToPoint(CGPointZero, _markerCenter)) {
// _popupView.center = CGPointMake(_markerCenter.x, _markerCenter.y - changeHeight);
// } else {
// _popupView.center = CGPointMake(_popupView.center.x, _popupView.center.y - changeHeight);
// }
The text was updated successfully, but these errors were encountered: