<legend id='6FH5H'><style id='6FH5H'><dir id='6FH5H'><q id='6FH5H'></q></dir></style></legend>

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

<small id='6FH5H'></small><noframes id='6FH5H'>

      • <bdo id='6FH5H'></bdo><ul id='6FH5H'></ul>
      <tfoot id='6FH5H'></tfoot>
      1. CALayer 性能与 UIImageView 性能

        时间:2024-04-15

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

              <tfoot id='RU7LX'></tfoot>
            1. <legend id='RU7LX'><style id='RU7LX'><dir id='RU7LX'><q id='RU7LX'></q></dir></style></legend>
                <bdo id='RU7LX'></bdo><ul id='RU7LX'></ul>

                <i id='RU7LX'><tr id='RU7LX'><dt id='RU7LX'><q id='RU7LX'><span id='RU7LX'><b id='RU7LX'><form id='RU7LX'><ins id='RU7LX'></ins><ul id='RU7LX'></ul><sub id='RU7LX'></sub></form><legend id='RU7LX'></legend><bdo id='RU7LX'><pre id='RU7LX'><center id='RU7LX'></center></pre></bdo></b><th id='RU7LX'></th></span></q></dt></tr></i><div id='RU7LX'><tfoot id='RU7LX'></tfoot><dl id='RU7LX'><fieldset id='RU7LX'></fieldset></dl></div>
                  <tbody id='RU7LX'></tbody>
                  本文介绍了CALayer 性能与 UIImageView 性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I'm noticing that some of the things that I do with images in my app, I could be doing with CALayer properties instead (i.e. borders, shadows, gradients, and so on). So I'm wondering, in general, is it a better idea to use CALayers and such, or just do all that stuff in photoshop and use UIImage(View)s for whatever I need? Scrolling performance has been kinda slow with drop shadows and stuff, so I'm basically trying to find every little optimization that I can.

                  Background information: I'm basically just scrolling through a bunch of images, vertically. Somewhat like the photos app. This is all from 3.2 onwards, so I have access to things like the shadow and shouldRasterize properties in CALayer.

                  解决方案

                  A key thing to know about CALayer shadows is that they are, by default, rendered from the layer's composited alpha channel; that can be really slow, particularly when the layer is rotating or changing size. You should look into the shadowPath property: if you give Core Animation a simple shape, such as a rectangle (UIBezierPath +bezierPathWithRect: with the layer's bounds will give you [via its CGPath property] a CGPathRef you can use there), you'll see much better performance.

                  shouldRasterize is also definitely useful, particularly with views that have many subviews that don't change often; make sure, though, that you set the layer's rasterizationScale to [UIScreen mainScreen].scale, or you'll get some nasty pixelation on high-resolution screens like the iPhone 4's.

                  这篇关于CALayer 性能与 UIImageView 性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:带有 UIImageView 的 Swift 自定义 UITableViewCell.需要将单元格大小调整为图像高度 下一篇:如何在没有 UIScrollView 的情况下放大和缩小 UIImageView?

                  相关文章

                    <bdo id='OyeqQ'></bdo><ul id='OyeqQ'></ul>
                • <small id='OyeqQ'></small><noframes id='OyeqQ'>

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

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