나는 아주 이상한 행동을 봅니다. 스크롤 뷰의 일부인보기 안에 텍스트보기가 표시됩니다. 텍스트보기에서 타이핑을 시작하면 키보드는 일반적으로 텍스트보기를 숨긴 다음 텍스트보기에 애니메이션을 적용하고 키보드 위에 밀어서 보이도록합니다. 그렇게하면 입력 한 텍스트를 볼 수있는 순간 키보드를 닫을 때까지 입력 한 세 번째 및 후속 행이 보이지 않습니다. 텍스트보기에서 타이핑을 시작하면 키보드를 숨기지 않기 때문에 움직이기 위해 애니메이션을 할 필요가 없습니다. 그런 다음 입력 한 모든 텍스트를 볼 수 있습니다. 따라서 텍스트가 나타날 때만 문제가 발생합니다. 보기 애니메이션입니다. 하지만 함께입력하는 동안 UITextView 텍스트 숨기기
- (void) makeTextViewVisible: (UITextView *)textArea up:(BOOL) up {
if (up) {
animatedDistance = 0;
CGPoint myPoint = [textArea.superview convertPoint:textArea.frame.origin toView:[UIApplication sharedApplication].keyWindow];
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationPortrait) {
animatedDistance = PORTRAIT_KEYBOARD_HEIGHT - (950 - myPoint.y) + 150;
}
else if (orientation == UIInterfaceOrientationPortraitUpsideDown) {
animatedDistance = PORTRAIT_KEYBOARD_HEIGHT + (PORTRAIT_KEYBOARD_HEIGHT - myPoint.y);
}
else if (orientation == UIInterfaceOrientationLandscapeLeft) {
animatedDistance = myPoint.x - LANDSCAPE_KEYBOARD_HEIGHT + 120;
}
else if (orientation == UIInterfaceOrientationLandscapeRight) {
animatedDistance = LANDSCAPE_KEYBOARD_HEIGHT - myPoint.x + 100;
}
if (animatedDistance < 0) {
animatedDistance = 0.0;
}
CGRect viewFrame = textArea.frame;
viewFrame.origin.y -= animatedDistance;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION];
[textArea setFrame:viewFrame];
[UIView commitAnimations];
}
else {
CGRect viewFrame = textArea.frame;
viewFrame.origin.y += animatedDistance;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION];
[textArea setFrame:viewFrame];
[UIView commitAnimations];
}
내가 textViewDidChange 내부 setNeedsDisplay/setNeedsLayout를 호출 시도 : 아래
self.textView = [[UITextView alloc] initWithFrame:CGRectMake(...)];
textView.font = [UIFont systemFontOfSize:18.0];
textView.backgroundColor = [UIColor whiteColor];
textView.userInteractionEnabled = YES;
textView.clipsToBounds = YES;
textView.delegate = self;
textView.layer.borderWidth = 1;
textView.layer.borderColor = [[UIColor blackColor] CGColor];
textView.layer.cornerRadius = 10;
[self addSubview:textView];
[textView release];
텍스트 뷰를 애니메이션 코드입니다 : 아래
텍스트 뷰를 작성 내 코드입니다 운.
누구나이 문제가 발생했거나 해결 방법을 알고 있습니까?
감사합니다.
매우 유용한 점. 나는 스크롤 위치를 조정하는 두 번째 아이디어를 좋아한다. –