简体   繁体   English

iOS-具有很大内容视图的UIScrollView,如何减少内存使用量?

[英]iOS - A UIScrollView with very large content view, how to reduce the memory usage?

The content view must contains lots of text(CATextLayer) and curves(CAShapeLayer). 内容视图必须包含大量文本(CATextLayer)和曲线(CAShapeLayer)。

If the content is too large, the app will crash because using memory too much. 如果内容太大,则由于使用过多内存,应用程序将崩溃。

Use a collection view or table view so that content outside the screen's bounds isn't rendered thus saving memory. 使用集合视图或表格视图,这样就不会呈现超出屏幕范围的内容,从而节省了内存。 Also the cells will be reused. 而且细胞将被重复使用。

Another solution could be continuing to use scroll view, but implementing this off screen reuse pattern yourself. 另一个解决方案可能是继续使用滚动视图,但自己实现屏幕外重用模式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM