About CGRectMake

It will sound extremely stupid and stupid, but I touched on a couple of languages, and they seem to have spoiled my feeling ... of orientation or something:

In Objective-C, you can use CGRectMake (x, y, w, h) to create a rectangle. Cool.

So, x, y defines the upper left corner of the rectangle or ... the center of the rectangle?

+4
source share
2 answers

Cocoa uses the Cartesian coordinate plane as its coordinate system (therefore (x, y) is set to the lower left corner). You can find out more about the coordinate system in the Cocoa Drawing Guide .

+4
source

In UIKit, (x, y) is the upper left corner.

+12
source

Source: https://habr.com/ru/post/1336642/


All Articles