1

So I'm a bit confused when it comes to using the .frame property, CGRectMake, and the iPhone coordinate system.

I was looking at the code given in this example: Sizing a UILabel to fit?

I am confused on the line:

self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, fixedWidth, 0);

In the above line of code, is it basically setting self.frame to the same origin as it was originally, but changing the width and height?

The origin is the center point like in normal geometry right? It's not the upper left hand corner like the iPhone coordinate system is right? Thanks.

Community
  • 1
  • 1
Crystal
  • 28,460
  • 62
  • 219
  • 393
  • In "normal geometry" (i.e. Cartesian coordinates) the origin of a polygon is typically reckoned to be its bottom left corner, actually. It's an offset from the origin, which is at the centre of the (infinite) Cartesian plane. – Jonathan Grynspan May 31 '11 at 20:25

1 Answers1

4

In the above line of code, is it basically setting self.frame to the same origin as it was originally, but changing the width and height?

Yes.

The origin is the center point like in normal geometry right? It's not the upper left hand corner like the iPhone coordinate system is right?

No. frame.origin is a corner of the frame.

See the documentation.

unbeli
  • 29,501
  • 5
  • 55
  • 57