我有以下代码:的UIScrollView回到它原来的地方
float yOffset = activeTextView.frame.origin.y - keyboardSize.height + 55;
CGPoint scrollPoint = CGPointMake(0.0, yOffset);
[scrollView setContentOffset:scrollPoint animated:YES];
这个动画滚动视图中- (void)keyboardWasShown:(NSNotification *)notification
我想了滚动回到它原来的位置后,隐藏键盘这样的:
- (void) keyboardWillHide:(NSNotification *)notification {
UIEdgeInsets contentInsets = UIEdgeInsetsZero;
scrollView.contentInset = contentInsets;
scrollView.scrollIndicatorInsets = contentInsets;
}
但它不起作用!
我怎样才能返回UIScrollView和实际上整个屏幕到其原始位置,使用户将看到他看到什么之前,滚动视图的动画?
我没有看到你注册UIKeyboardWillHideNotification的任何代码。你的-keyboardWillHide:方法如何被调用? – NSResponder
我在viewDidLoad中注册[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown :) name:UIKeyboardDidShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide :) name:UIKeyboardWillHideNotification object:nil]; – Dejell