无限水平 UIScrollView 空间同时节省内存?
我正在实现 UITableView 和 UITableViewCell 子类。这些对象将在屏幕上绘制线条,但也允许用户放大。当用户“放大”时,线条会水平放大,但不会垂直放大。这反过来又导致我的表格内容宽度随着每次放大而增加 50%。
我遇到的问题是,如果我放大 12 倍,应用程序就会耗尽内存并崩溃。放大 12 倍会将表格/单元格尺寸从 300 点增加到 35000 点。即使我在drawRect中什么都不做,看起来仅仅表视图的大小就会使应用程序崩溃。
以前有人解决过此类问题吗?我尝试搜索但没有找到类似的东西。我可以伪造视图大小。我想只绘制 2 倍的可见空间,然后在发生某些滚动事件时重新绘制。这似乎是可以管理的。有人用 UIScrollView 做过这个吗?在不耗尽内存的情况下实现几乎无限的水平空间的正确方法是什么?
I'm implementing UITableView and UITableViewCell subclasses. These objects will draw lines on the screen, but also allow the user to zoom in. When the user "zooms in" the lines scale up horizontally, but not vertically. This in turn causes my table content width to increase by 50% with each zoom-in.
The problem that I'm having is that if I zoom-in 12 times, the App runs out of memory and crashes. Zooming in 12 times increases the table/cell dimensions from 300 points to say 35000 points. Even if I do nothing in drawRect, it appears the mere size of the table view alone will crash the App.
Has anyone solved this type of issue before? I tried searching but didn't find anything similar. I'm fine with faking a view size. I'd like to just draw 2x the visible space and then redraw when some scroll event happens. This seems to be manageable. Has anyone done this with UIScrollView? What is the right way to achieve virtually unlimited horizontal space without running out of memory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论