Overview
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.
CGSize와 다르게 origin을 가진다.
public struct CGRect {
public var origin: CGPoint
public var size: CGSize
public init()
public init(origin: CGPoint, size: CGSize)
}
(1,2) x : 1, y : 2
public struct CGPoint {
public var x: CGFloat
public var y: CGFloat
public init()
public init(x: CGFloat, y: CGFloat)
}
Overview
A CGSize structure is sometimes used to represent a distance vector, rather than a physical size. As a vector, its values can be negative. To normalize a CGRect structure so that its size is represented by positive values, call the standaradized function.
public struct CGSize {
public var width: CGFloat
public var height: CGFloat
public init()
public init(width: CGFloat, height: CGFloat)
}