平滑的UITextView自动滚动到画面底部 [英] Smooth UITextView auto scroll to bottom of frame

查看:356
本文介绍了平滑的UITextView自动滚动到画面底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

林用X code 5.1.1 ios7发展。由于没有进入UITextView的新的文本,我想它如果文本上升,留有余地用户看到新的文本。我有一些作品,但显示新文本是尴尬的动画。它几乎一样,如果它的每一个时间的推移,从文本的最顶端,并迅速进入底部其名为

Im using Xcode 5.1.1 developing for ios7. As there is new text entering the UITextView, I would like it if the text went up, leaving room for the user to see the new text. I have something that works but the animation that shows the new text is awkward. Its almost as if it goes from the very top of the text and quickly goes to the bottom every time its called.

CGPoint P = [TextView的contentOffset]
[TextView的setContentOffset:对动画:NO];
[TextView的scrollRangeToVisible:NSMakeRange([textview.text长度 - 1,0);

这code获取调用在每次进入新文本的时间。我想它是作为默认的iPhone信使它只是向上滑动随便一样光滑。

This code is getting called every time new text is entered. I would like it to be as smooth as the default iPhone messenger where it just slides up casually.

推荐答案

正确的答案是设置:

_consoleView.layoutManager.allowsNonContiguousLayout = NO;

在viewDidLoad中

In ViewDidLoad

然后:

_consoleView.text = text;
[_consoleView scrollRangeToVisible:NSMakeRange(_consoleView.text.length - 1, 1)];

这篇关于平滑的UITextView自动滚动到画面底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆