开发者

CGRectFrame, getting confused on origins

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 poi开发者_如何学Cnt like in normal geometry right? It's not the upper left hand corner like the iPhone coordinate system is right? Thanks.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜