Open matthewyan opened 8 years ago
这个控件没有实现局部刷新,所以目前只适用于少量文本的输入和展示,不适用于大量文本的输入、大量富文本的编辑。 这个稍后我会在 readme 里更新说明。
富文本的编辑对长文本的需求应该还是比较大的 :)
如果可能,在以后会尝试进行优化吧。
Hi Yaoyuan,
Just came across your awesome library. I would like to second that support for long text input would be great. Today if I add about 32 KB of text, the app ends up using over 200 MB of memory, and things slow down dramatically (sometimes text starts to disappear and XPC warnings come up in the console). I don't know much about CoreText, but is there some fundamental architectural reason why supporting large documents is particularly difficult? What kind of changes would be needed to add support for it in YYTextView?
I know Apple struggled with it themselves when they've re-written UITextView on top of TextKit in iOS 7. At the time, UITextView would consume just as much memory, but they seem to have fixed it in iOS 8 and above.
Best Regards, -Christoph
It needs to split and cache text and text layout results, text view's contents needs to be split and draw with the mechanism similar to UITableView. I may need to rewrite the entire text view to implement these features.
长文本的编辑可能用 TableView 会比较好一点…… 比如锤子便签和 WeicoNote。
长文本确实会有性能问题。。。
文本超过5K,输入文字就比较卡