我有以下代码:
float yOffset = activeTextView.frame.origin.y - keyboardSize.height + 55;
CGPoint scrollPoint = CGPointMake(0.0, yOffset);
[scrollView setContentOffset:scrollPoint animated:YES];
这将动画滚动视图- (void)keyboardWasShown:(NSNotification *)notification
我试图在隐藏键盘后将scrollView返回到它的原始位置,如下所示:
- (void) keyboardWillHide:(NSNotification *)notification {
UIEdgeInsets contentInsets = UIEdgeInsetsZero;
scrollView.contentInset = contentInsets;
scrollView.scrollIndicatorInsets = contentInsets;
}
但它不起作用!
如何将 UIScrollView 和整个屏幕返回到其原始位置,以便用户在滚动视图动画之前看到他看到的内容?