TPKeyboardAvoidingScrollView.m에는 키보드를 숨길 때 호출되는 메서드 (keyboardWillHide :)가 있습니다. 이 방법에서는 scrollview의 내용 오프셋이 CGPointZero로 설정되므로 scrollview가 첫 번째보기 컨트롤러에 표시됩니다. 이것은 당신이 TPKeyboardAvoidingScrollView의 객체를 사용하여 다른 뷰에 영향을 줄 수 있다는 점에 유의 textfield-
- (void)keyboardDidShow:(NSNotification*)notification {
[self setScrollEnabled:NO];
//existing code
}
- (void)keyboardWillHide:(NSNotification*)notification {
[self setScrollEnabled:YES];
//existing code with modification of content offset
}
을 편집하는 동안
- (void)keyboardWillHide:(NSNotification*)notification {
_keyboardRect = CGRectZero;
_keyboardVisible = NO;
// Restore dimensions to prior size
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:[[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]];
[UIView setAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]];
self.contentInset = _priorInset;
//self.contentOffset = CGPointZero;//Replacing this with below line
self.contentOffset = CGPointMake(self.contentOffset.x, 0);
[self setScrollIndicatorInsets:self.contentInset];
_priorInsetSaved = NO;
[UIView commitAnimations];
}
스크롤을 중지하십시오.
감사합니다. 키보드가 튀어 나올 때 좌우로 스 와이프 할 수있는 방법을 어떻게 중지시킬 수 있습니까? – Shinonuma
편집 중에 스크롤하는 것을 방지하기위한 답변이 업데이트되었습니다. –