1. <small id='TvyHO'></small><noframes id='TvyHO'>

  2. <i id='TvyHO'><tr id='TvyHO'><dt id='TvyHO'><q id='TvyHO'><span id='TvyHO'><b id='TvyHO'><form id='TvyHO'><ins id='TvyHO'></ins><ul id='TvyHO'></ul><sub id='TvyHO'></sub></form><legend id='TvyHO'></legend><bdo id='TvyHO'><pre id='TvyHO'><center id='TvyHO'></center></pre></bdo></b><th id='TvyHO'></th></span></q></dt></tr></i><div id='TvyHO'><tfoot id='TvyHO'></tfoot><dl id='TvyHO'><fieldset id='TvyHO'></fieldset></dl></div>
  3. <legend id='TvyHO'><style id='TvyHO'><dir id='TvyHO'><q id='TvyHO'></q></dir></style></legend>

      <bdo id='TvyHO'></bdo><ul id='TvyHO'></ul>
  4. <tfoot id='TvyHO'></tfoot>

      由于 UIImageViews,应用程序运行缓慢

      时间:2024-04-15
      <legend id='7mhId'><style id='7mhId'><dir id='7mhId'><q id='7mhId'></q></dir></style></legend>

      <i id='7mhId'><tr id='7mhId'><dt id='7mhId'><q id='7mhId'><span id='7mhId'><b id='7mhId'><form id='7mhId'><ins id='7mhId'></ins><ul id='7mhId'></ul><sub id='7mhId'></sub></form><legend id='7mhId'></legend><bdo id='7mhId'><pre id='7mhId'><center id='7mhId'></center></pre></bdo></b><th id='7mhId'></th></span></q></dt></tr></i><div id='7mhId'><tfoot id='7mhId'></tfoot><dl id='7mhId'><fieldset id='7mhId'></fieldset></dl></div>

        <small id='7mhId'></small><noframes id='7mhId'>

          <bdo id='7mhId'></bdo><ul id='7mhId'></ul>
        • <tfoot id='7mhId'></tfoot>

                <tbody id='7mhId'></tbody>
                本文介绍了由于 UIImageViews,应用程序运行缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                在我的 iPad 应用程序中,我有三个显示图像的大型 UIImageView(每个都几乎是屏幕的大小,并且它们具有特殊效果,例如旋转、阴影 等,看起来像一个新闻堆栈).当显示这些图像时,应用程序会非常缓慢地运行.UIAlertViews 从字面上看,当它们呈现时它们只有两帧,并且动画甚至没有滞后......它们更糟!但是当我不展示 UIImageViews 时,一切都会快速而优雅地运行.显然我做错了,因为 iOS 肯定可以处理三个图像.关于如何使应用程序运行得更快的任何建议?谢谢.

                I have three large UIImageViews displaying images within my iPad app (each is almost the size of the screen, and they have special effects such as rotation, shadows, etc to look like a news stack). When these images are displayed, the app runs VERY SLOWLY. UIAlertViews literally look like they have only two frames when they are presented and animations aren't even laggy... they're worse! But when I do not present the UIImageViews, everything works quickly and elegantly. Obviously I'm doing something incorrectly since iOS can surely handle three images. Any suggestions on how to make the app run more quickly? Thanks.

                PS 我什至不想知道当我将新 iPad 的图像分辨率加倍时会发生什么哈哈

                PS I don't even want to know what will happen when I double the resolution of the images for the new iPad haha

                编辑:这是我用来设置阴影的代码.这利用了 QuartzCore 框架.

                Edit: Here is the code I am using to set the shadows. This utilizes the QuartzCore framework.

                page2.layer.shadowColor = [UIColor blackColor].CGColor;
                page2.layer.shadowOpacity = 1.0;
                page2.layer.shadowRadius = 10.0;
                page2.layer.shadowOffset = CGSizeMake(0, 4);
                

                编辑 2(答案):似乎由于我设置阴影的方式而出现了延迟.如果您将 shadowPath 属性设置为 UIImageViews 边界的 UIBezierPath,则渲染会更快更流畅,并且应用程序会显着加速.这是我的最终代码:

                Edit 2 (Answer): It appears that the lag occurs because of the way I am setting the shadows. If you set the shadowPath property to be a UIBezierPath of the bounds of the UIImageViews, rendering occurs more quickly and smoothly and the app speeds up significantly. Here is my final code:

                page2.layer.shadowColor = [UIColor blackColor].CGColor;
                page2.layer.shadowOpacity = 1.0;
                page2.layer.shadowRadius = 10.0;
                page2.layer.shadowOffset = CGSizeMake(0, 4);
                page2.layer.masksToBounds = NO;
                UIBezierPath *path2 = [UIBezierPath bezierPathWithRect:page2.bounds];
                page2.layer.shadowPath = path2.CGPath;
                

                推荐答案

                看不到实际代码,只能猜测.

                We can only guess without seeing the actual code.

                • 阴影可能非常昂贵.如果关闭它们或减小 shadowRadius 会更快吗?
                • 设置 shadowPath 属性可以带来巨大的改进,如果您可以使用它来获得您想要的效果.
                • 否则:将阴影烘焙到图像中,或使用其他技术来伪造图像边缘周围的阴影.
                • Shadows can be extremely expensive. Does it get faster if you turn them off, or decrease the shadowRadius?
                • Setting the shadowPath property can lead to a huge improvement, if you can use it to get the effect you're looking for.
                • Otherwise: bake the shadows into your images, or use some other technique to fake the shadows around the edges of your images.

                这篇关于由于 UIImageViews,应用程序运行缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何将多个 UIImageView 合并为一个 UIImage 下一篇:暂停 UIImageview 动画

                相关文章

                <small id='OAJyC'></small><noframes id='OAJyC'>

              1. <legend id='OAJyC'><style id='OAJyC'><dir id='OAJyC'><q id='OAJyC'></q></dir></style></legend>
                <tfoot id='OAJyC'></tfoot>

                      <bdo id='OAJyC'></bdo><ul id='OAJyC'></ul>
                    <i id='OAJyC'><tr id='OAJyC'><dt id='OAJyC'><q id='OAJyC'><span id='OAJyC'><b id='OAJyC'><form id='OAJyC'><ins id='OAJyC'></ins><ul id='OAJyC'></ul><sub id='OAJyC'></sub></form><legend id='OAJyC'></legend><bdo id='OAJyC'><pre id='OAJyC'><center id='OAJyC'></center></pre></bdo></b><th id='OAJyC'></th></span></q></dt></tr></i><div id='OAJyC'><tfoot id='OAJyC'></tfoot><dl id='OAJyC'><fieldset id='OAJyC'></fieldset></dl></div>