Post

Replies

Boosts

Views

Activity

Disabling Line Wrapping in Large UITextViews
Hello, I build an app which allows users to view code. As it exists today, we have line wrapping enabled on our UITextViews that house our code, but we would ideally like to be able to disable line-wrapping. Our view hierarchy can be described as such: We have UITableViewController whose cells contain a UIScrollView that then contains a UITextView. The UITextView has all of the contents of the code that the user is viewing. It initially works fine, but after continuous, we frequently run into CoreAnimation memory allocation issues that result in flickering and poor scroll performance: [Render] CoreAnimation: failed to allocate 3821632 bytes Our cell is implemented pretty trivially: CodeCell.swift - https://developer.apple.com/forums/content/attachment/6b2b9f2a-e75f-4902-8b9c-360b24a14450 The only bit of custom drawing we're doing here is related to drawing the line numbers in the leading gutter of the view, and that's being done in the layout manager. We still encounter memory allocation issues without the custom drawing. After profiling using instruments, it seems that most of the work is being done in CGSColorMaskCopyARGB8888. I've also profiled for memory leaks, of which there are none. I'd greatly appreciate some assistance in being able to efficiently implement a UITextView that doesn't have line-wrapping enabled. It seems to fall apart in this use case with nested scroll views and large code files with syntax highlighting.
2
0
1.2k
Jun ’20