Why different iOS frameworks and frameworks

in iOS controls, we have borders and borders. The frame coordination system, in relation to its parent and associated boundary coordinate system, refers to itself. But why does iOS have a different coordination system for these two versions?


source to share

1 answer

The width and height of the view are the same whether we're looking at borders or borders. The difference is that x, y positions the view. In the case of borders, the x and y coordinates are 0.0, since those coordinates are relative to the view itself. However, the x and y frame coordinates are relative to the position of the view in the parent view.

If you get the same results for both properties, it means that the view is populated by its supervisor and both views have (0, 0) as their source. Try changing the frame and you will see that it moves to different positions within your observation.

The boundaries of a view describe the location and size of a view in its own coordinate system, while its frame describes the location and size of a view in its supervisor coordinate system. Thus, the frame views of the root view are in the window coordinate system. A notable characteristic of UIWindow is that its coordinate system is always in portrait orientation. Thus, the views of the root view controllers will not properly account for changes in the orientation of the interface, but its bounds will. Therefore, you should always perform layout calculations using the size of the view manager's view boundaries as opposed to its frame size.


Ios fundamentals: frames, borders and CGGeometry

Refer: what's the difference between frame n boundaries?



All Articles