당신의 UITextField 내부의 텍스트를 쓰기 시작할 때 단점을 스크롤하려면 다음을 사용 : 완전히 볼 수 있도록하기 위해 당신이 당신의 텍스트 뷰를 편집
또한
[yourScrollView scrollRectToVisible:CGRectMake(yourTextfield.frame.origin.x,yourTextField.frame.origin.y,yourScrollView.frame.size.width,yourScrollView.frame.size.height) animated:YES];
는, (즉 textViewDidBeginEditing의 방법), 그 프레임을 작게 만들. 그런 다음 텍스트 편집 (예 : textViewDidEndEditing 메소드)을 완료하면 프레임을 원래대로 설정합니다.
편집 : 편집이 완료되면
//add this in .h file
NSInteger originalHeight;
//in .m file
- (void) textViewDidBeginEditing:(UITextView *)textView
{
[yourScrollView scrollRectToVisible:CGRectMake(yourTextView.frame.origin.x,yourTextView.frame.origin.y,yourScrollView.frame.size.width,yourScrollView.frame.size.height) animated:YES];
//now set the frame
//you just need to change the height, rest can be kept whatever they are
//set the newHeight so as to make the textview visible
originalHeight = yourTextView.frame.size.height;
yourTextView.frame = CGRectMake(x,y,width,newHeight);
//rest of the code
}
지금, 그것은 예전으로 높이를 설정합니다.
- (void) textViewDidEndEditing:(UITextView *)textView
{
yourTextView.frame = CGRectMake(x,y,width,originalHeight);
}
이 코드를 추가 하시겠습니까? 첫 번째 ScrollDown- 메서드를 추가 할 위치는 어디입니까? – Kovu
수정 된 답변보기 – mayuur