Saturn
Saturn

Reputation: 18139

About CGRectMake

This will sound extremely silly and stupid, but I have touched a couple languages and they kind of messed up my sense of.... orientation or something:

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

So x,y set the... top left corner of the rect, or.... the center of the rect?

Upvotes: 4

Views: 10071

Answers (2)

Heath Borders
Heath Borders

Reputation: 32107

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

Upvotes: 12

Itai Ferber
Itai Ferber

Reputation: 29764

Cocoa uses the Cartesian coordinate plane as its coordinate system (so (x, y) is set to the bottom-left corner). You can read more about the coordinate system in the Cocoa Drawing Guide.

Upvotes: 4

Related Questions