How to make a UIScrollView with a UITextView sub view not scroll when adding text?
I have a UIScrollView which has a subview UITextView. When I added text to UITextView by code, the view is开发者_StackOverflow社区 scrolling to the last line. I want the view not to scroll when I add text to UITextView by code. Anyone can help me fix the problem?
Finally I can fix my problem.
We just set YES the setScrollEnabled in UITextView before we change the text in UITextView and set NO after we change the text.
Here the example code
[yourTextView setScrollEnabled:YES];
yourTextView.text = [someString copy];
[yourTextView setScrollEnabled:NO];
:)
精彩评论