Confusing (x, y) origins with sub-views in interface builder
I have a view in interface builder, and then a subview within that view. I place the sub-view visually near the upper left corner within its parent. I would therefore expect the x, y coordinates of the sub-views frame to be something close开发者_开发知识库 to (20,20), but instead IB tells me it is something like (230,432). If I then adjust the X, Y coords in the properties window to something like (20,20), the sub-view flies off the screen towards the upper-left... What is the deal? BTW, it is an iPad specific view size, where the top/parent view is sized 768x1004.
In the Size & Position section, in the grid on the left, make sure the top-left corner dot is selected. The dot selected in this grid determines what the X and Y coordinates refer to.
You may have the center dot selected and so the X,Y coordinates indicate the coordinates of the sub-view's center relative to the parent.
精彩评论