I have a UIScrollView which has a subview UITextView. When I added text to UITextView by code, the view is 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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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];
:)