当我从下往上滚动时,iOS UITextView会自动滚动到底部

时间:2014-01-07 07:27:43

标签: ios scroll uitextview

我创建了一个iOS项目,它只包含一个完整整个屏幕的UITextView。 在控制器中,我执行以下操作

//textView is declared in the .h file which keeps a reference to the UITextView
textView.text = @"";//a long text(over 5000 words), and contains many '\n'
if(textView.text.length > 0) {
    NSRange bottom = NSMakeRange(textView.text.length -1, 1);
    [textView scrollRangeToVisible:bottom];
}

textView显示一个很长的文本,其中包含5000个或更多单词,文本中包含许多'\ n'。

然后我在模拟器iOS 7.0上运行项目,并从下到上滚动。然后UITextView自动滚动到底部。 请帮我。我已经坚持这个问题很长一段时间了。

0 个答案:

没有答案