iOS7 UITExtView 커서 문제
2638 단어 UITextView
1 -(void)textViewDidChange:(UITextView *)textView {
2 CGRect line = [textView caretRectForPosition:
3 textView.selectedTextRange.start];
4 CGFloat overflow = line.origin.y + line.size.height
5 - ( textView.contentOffset.y + textView.bounds.size.height
6 - textView.contentInset.bottom - textView.contentInset.top );
7 if ( overflow > 0 ) {
8 // We are at the bottom of the visible text and introduced a line feed, scroll down (iOS 7 does not do it)
9 // Scroll caret to visible area
10 CGPoint offset = textView.contentOffset;
11 offset.y += overflow + 7; // leave 7 pixels margin
12 // Cannot animate with setContentOffset:animated: or caret will not appear
13 [UIView animateWithDuration:.2 animations:^{
14 [textView setContentOffset:offset];
15 }];
16 }
17 }
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Auto Layout을 사용하여 키보드에 맞게 뷰를 크기 조정하는 방법iOS6에서 사용할 수 있는 Auto Layout을 이용하여 키보드가 표시/숨겨지면 UITextView를 리사이즈해 봅니다. UITextView를 붙여넣습니다. UITextView의 Constraints의 Botto...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.