如何加速和使 iPhone 中的单元格平滑滚动?

发布于 2024-09-25 09:56:12 字数 392 浏览 1 评论 0原文

我使用 UIView 和 UITableViewController 做了一个文本渲染程序。我所做的是在使用drawRect方法之前,我只是计算所有单元格的高度以及每个文本的开始和结束。高度,宽度。这样,我可以近似估计单元高度,然后绘制文本。

我为肖像和肖像都这样做了。横向模式。我的程序看起来像 Twitter 更新。当用户更改为横向模式时,我为横向模式计算了相同的结果。下次,我只需检索存储的用于绘制文本的数据(在应用程序退出之前有效)。

现在我的问题是,当我的投入较少时,它效果很好。但对于巨大的输入(例如 100 个输入),显示文本需要一些时间。另外,我的程序的滚动有些不流畅。我的应用程序中也没有泄漏。

请任何人建议我做这个应用程序的好方法,并使它如此顺利和更快......

提前致谢, 拉伊坎特

i did a text rendering program using UIView and UITableViewController. What i did is before going drawRect method, i just calculate all of the cells height as well as each text start & height,width. So that, i can estimate the cell height approximately and then i draw the text.

I did this for both portrait & landscape mode. My program looks like twitter updates. When the user changed to landscape mode i calculated the same things for landscape mode. Next time, i simply retrieve the stored data for drawing text(Valid before application quits).

Now my problem is, when my inputs are less, it works good. But for the huge input say 100 inputs, it takes some time to show the text. Also, my program's scrolling is somewhat not smooth. Also there is no leak in my application.

Please anyone suggest me the good way to do this application and make it so smooth and faster...

Thanks in Advance,
Rajkanth

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

微暖i 2024-10-02 09:56:12

对此的简短回答是尽量减少在渲染单元格时进行的任何计算。这包括任何透明背景。为了实现最快的滚动,理想情况下您应该拥有很少量的非不透明元素。

The short answer to this is to minimize any computation you do in rendering of the cells. This includes any transparent backgrounds. To achieve the fastest scrolling, ideally you would have very few amounts of non-opaque elements.

滿滿的愛 2024-10-02 09:56:12

诀窍是通过将所有单独的元素合并到一个视图中来仅拥有一个大的不透明元素。

http://blog.atebits.com/2008/ 12/快速滚动-tweetie-with-uitableview/

The trick is to only have one big opaque element by coalescing all your individual elements into a single view.

http://blog.atebits.com/2008/12/fast-scrolling-in-tweetie-with-uitableview/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文