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

        <tfoot id='qJKnw'></tfoot>

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

        CGAffineTransform 旋转走错路了

        CGAffineTransform rotation goes the wrong way(CGAffineTransform 旋转走错路了)
      3. <i id='ysSdO'><tr id='ysSdO'><dt id='ysSdO'><q id='ysSdO'><span id='ysSdO'><b id='ysSdO'><form id='ysSdO'><ins id='ysSdO'></ins><ul id='ysSdO'></ul><sub id='ysSdO'></sub></form><legend id='ysSdO'></legend><bdo id='ysSdO'><pre id='ysSdO'><center id='ysSdO'></center></pre></bdo></b><th id='ysSdO'></th></span></q></dt></tr></i><div id='ysSdO'><tfoot id='ysSdO'></tfoot><dl id='ysSdO'><fieldset id='ysSdO'></fieldset></dl></div>

        1. <legend id='ysSdO'><style id='ysSdO'><dir id='ysSdO'><q id='ysSdO'></q></dir></style></legend>
            <tbody id='ysSdO'></tbody>
              <tfoot id='ysSdO'></tfoot>
              • <bdo id='ysSdO'></bdo><ul id='ysSdO'></ul>
              • <small id='ysSdO'></small><noframes id='ysSdO'>

                  本文介绍了CGAffineTransform 旋转走错路了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  在我的实验中,我得出以下结论:

                  YourView.transform = CGAffineTransformMakeRotation(正值);

                  将顺时针旋转视图,并且

                  YourView.transform = CGAffineTransformMakeRotation(负值);

                  将逆时针旋转视图,

                  但是文件说:

                  旋转仿射变换的角度,以弧度为单位.在 iOS 中,正值表示逆时针旋转,负值表示顺时针旋转.

                  这些是否相互矛盾?

                  解决方案

                  你的困惑是可以理解的.

                  实际上,正角度表示从正 X 轴向正 Y 轴的旋转.负角表示从正 X 轴向负 Y 轴旋转.

                  原生"Core Graphics 坐标系仿照标准 解释了这一点.)您可以通过查看当前变换矩阵来检查这一点(使用 CGContextGetCTM).你会发现它的d元素中有一个-1,表示Y轴翻转了.

                  UIView 也使用翻转坐标系来布置其子视图,这会影响 UIView transform 属性的含义.

                  In my experiment, i conclude these:

                  YourView.transform = CGAffineTransformMakeRotation( positive value ); 
                  

                  will rotate the view clockwise, and

                  YourView.transform = CGAffineTransformMakeRotation( Negative value ); 
                  

                  will rotate the view counterclockwise,

                  But the document says:

                  The angle, in radians, by which to rotate the affine transform. In iOS, a positive value specifies counterclockwise rotation and a negative value specifies clockwise rotation.

                  does those contradict with each other?

                  解决方案

                  Your confusion is quite understandable.

                  In truth, a positive angle represents a rotation from the positive X axis toward the positive Y axis. A negative angle represents a rotation from the positive X axis toward the negative Y axis.

                  The "native" Core Graphics coordinate system is modeled after the standard Cartesian coordinate system, in which the Y axis increases upward on the page. In this system, a positive angle represents a counter-clockwise rotation:

                  So if you create your own CGContext (for example, by using CGBitmapContextCreate or CGPDFContextCreate), rotations will work as you expect.

                  However, computer systems have historically used a coordinate system in which the Y axis increases downward on the page. In a flipped coordinate system like this, a positive angle represents a clockwise rotation:

                  Notice that in both coordinate systems, a positive angle rotates from the positive X axis toward the positive Y axis.

                  It turns out that UIKit flips the coordinate system of the graphics contexts that it creates for you. This includes the graphics context it sets up before sending you drawRect: and the graphics context it sets up in UIGraphicsBeginImageContext. (The Quartz 2D Programming Guide explains this.) You can check this by looking at the current transform matrix (using CGContextGetCTM). You will find that it has a -1 in its d element, meaning that the Y axis is flipped.

                  A UIView also uses a flipped coordinate system for laying out its subviews, which affects the meaning of the UIView transform property.

                  这篇关于CGAffineTransform 旋转走错路了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How To Create a Rotating Wheel Control?(如何创建转轮控件?)
                  iOS 6 rotations: supportedInterfaceOrientations doesn#180;t work?(iOS 6 旋转:supportedInterfaceOrientations 不起作用?)
                  CABasicAnimation rotate returns to original position(CABasicAnimation 旋转返回原始位置)
                  How to avoid restarting activity when orientation changes on Android(如何在 Android 上的方向更改时避免重新启动活动)
                  UITabBarController Rotation Issues in ios 6(ios 6 中的 UITabBarController 旋转问题)
                  iOS: How to run a function after Device has Rotated (Swift)(iOS:设备旋转后如何运行函数(Swift))

                  <tfoot id='yrux2'></tfoot>
                  • <small id='yrux2'></small><noframes id='yrux2'>

                        <tbody id='yrux2'></tbody>
                    • <legend id='yrux2'><style id='yrux2'><dir id='yrux2'><q id='yrux2'></q></dir></style></legend>

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

                          <bdo id='yrux2'></bdo><ul id='yrux2'></ul>