키보드를 열었을 때 ScrollView 크기를 변경하려면 현재 keyboardWillBeHidden
및 keyboardFrameDidChange
메서드에 등록하십시오.iOS - 방법 외에 키보드 알림을 참조하는 방법은 무엇입니까?
if ([textView.text hasSuffix:@"\n"]) {
[CATransaction setCompletionBlock:^{[self scrollToCaretInTextView:self.logText animated:NO];}];
} else {
[self scrollToCaretInTextView:self.logText animated:NO];}
이 참고 문헌이 방법 :
- (void)scrollToCaretInTextView:(UITextView *)textView animated:(BOOL)animated
{
CGRect rect = [textView caretRectForPosition:textView.selectedTextRange.end];
rect.size.height += textView.textContainerInset.bottom;
[textView scrollRectToVisible:rect animated:animated];
}
가 어떻게이 내 알림을 참조 할 수 있습니다 내 textViewDidChange
에서
, 나는 커서가보기에 있는지 확인하기 위해 약간의 텍스트가 scrollToCaretInTextView
키보드가 올라 갔을 때 CGRect를 변경할 수 있습니까? 이제 커서가 키보드 아래에있을 때 인식하지 못합니다.
나는이 문제를 해결하려고 노력했지만, 키보드 높이를 가져와야하고 NSNotificaiton이 아니기 때문에이 방법에이 방법을 적용하는 방법을 모르겠습니다.