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

    • <bdo id='nPqP2'></bdo><ul id='nPqP2'></ul>

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

        <legend id='nPqP2'><style id='nPqP2'><dir id='nPqP2'><q id='nPqP2'></q></dir></style></legend>
      1. 为什么 UIView 框架是由浮动组成的?

        时间:2023-10-23
        <tfoot id='lVkRY'></tfoot>

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

            <tbody id='lVkRY'></tbody>

          <legend id='lVkRY'><style id='lVkRY'><dir id='lVkRY'><q id='lVkRY'></q></dir></style></legend>

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

                1. 本文介绍了为什么 UIView 框架是由浮动组成的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  从技术上讲,x、y、宽度和高度表示一组与像素相关的维度.一世不能有 200.23422 像素那么为什么他们使用浮点数而不是整数?

                  Technically the x, y, width, and height represent a set of dimensions that relate to pixels. I can't have 200.23422 pixels so why do they use floats instead of ints?

                  推荐答案

                  浮点数的原因是现代 CPU 和 GPU 经过优化,可以并行处理许多浮点数.iOS 和 Mac 都是如此.

                  The reason for the floats are that modern CPUs and GPUs a are optimized to work with many floating point numbers in parallel. This is true for iOS as well as Mac.

                  使用 Quartz,您无需处理单个像素,但您绘制的所有内容始终是抗锯齿的.当您有一个坐标 1.0, 1.0 时,这实际上为坐标原点的 2x2 像素添加了颜色.

                  With Quartz you don't address individual pixels, but everything you draw is always antialiased. When you have a coordinate 1.0, 1.0 then this actually adds color to the 2x2 pixels at the coordinate origin.

                  这就是为什么在整数坐标处绘制时可能会出现线条模糊的原因.在非视网膜上,您必须绘制 0.5 的偏移量.从技术上讲,您需要偏移 0.25 才能在 Retina 显示器上绘制精确的像素.虽然在那里它并不重要,因为在那个像素大小上你真的看不到它了.

                  This is why you might get blurry lines if you draw at integer coordinates. On non-retina you habe to draw offset by 0.5. Technically you would need to offset by 0.25 to draw exact pixels on Retina displays. Though there it does not really matter that much because you don't really see it any more at that pixel size.

                  长话短说:您不会直接处理像素,但图形引擎会为您在浮点坐标和像素之间映射.

                  Long story short: you don't address pixels direcrly, but the Graphics engine maps between floating point coordinates and pixels for you.

                  这篇关于为什么 UIView 框架是由浮动组成的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 Grand Central Dispatch 时如何发布 NSNotification? 下一篇:在 iOS 4.2 中未正确绘制子类 UIAlertView

                  相关文章

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

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