在什么情况下 iOS 上的坐标 space 是(未翻转的)默认值?

In what contexts is the coordinate space on iOS the (unflipped) default?

根据 documentation for CGRect

In the default Core Graphics coordinate space, the origin is located in the lower-left corner of the rectangle and the rectangle extends towards the upper-right corner. If the context has a flipped-coordinate space—often the case on iOS—the origin is in the upper-left corner and the rectangle extends towards the lower-right corner.

我一直以为iOS上的坐标系是从左上角开始的,但是看了这个之后,它被翻转了是有道理的,而不是默认坐标space。您不会像在 iOS 上那样考虑笛卡尔图上的点,其中添加到 Y 值会向下移动,而不是向上移动。

文档说是 'often the case',那么什么时候 iOS 不是这样呢?在什么平台上坐标 space 是 Core Graphics 默认值?

在 iOS 和 UIKit 中,原点在左上角,正 y 值朝向屏幕底部。

但对于较低级别的 Quartz API,原点位于左下角,y 值向上朝向屏幕顶部。

这在 Quartz 2D Programming Guide under the section titled Drawing to a View Graphics Context in iOS 中有介绍。

The default coordinate system used throughout UIKit is different from the coordinate system used by Quartz. In UIKit, the origin is in the upper-left corner, with the positive-y value pointing downward. The UIView object modifies the CTM of the Quartz graphics context to match the UIKit conventions by translating the origin to the upper left corner of the view and inverting the y-axis by multiplying it by -1. For more information on modified-coordinate systems and the implications in your own drawing code, see Quartz 2D Coordinate Systems.

所以 "often the case" 是在使用 UIKit 时。使用较低级别的 Quartz API 时情况并非如此。