View debugging
By using the view debugger to examine your view hierarchy, you can easily determine view location, size, and implementation issues.
- Run your application in Xcode and click the Debug View Hierarchy button on the Debug bar to enter the view debugger.
Xcode stops your application, displays the view hierarchy in the debug navigation bar, and displays an interactive three-dimensional model in the main editor.
Select the window that appears, click anywhere in the main editor, and press the mouse button to drag. Views are decomposed into three-dimensional hierarchies, allowing you to see the hierarchy of the view layer and the relationship between views.
The slide button on the left allows you to adjust the view spacing so that you can more easily observe individual view objects. The swipe button on the right allows you to filter out a specific view in a complex view hierarchy using a "back to front" or "front to back" approach.
- In the middle of the two sliding buttons is the editor button
-
Click the Crop button to display the contents of the currently displayed entity in the main editor.
-
Click the Show Constraints button to display the automatic layout constraints for the currently selected view layer in the main editor.
Note: Dimensional inspection allows you to check the size and constraint values.
- Use the reset button to have the view in the main editor appear in a standard direction.
- Click the View Mode button to choose whether to display the view content, wireframe, and content in the main editor.
- The zoom control group allows you to increase or decrease the display multiplier, or display the standard size.
Note : You can also zoom out on the main editor using grip gestures. Scroll through the displayed view with two finger drag gestures in the editor window.
Displays colors and dimensions precisely in pixels on the main editor.
- Select a view entity in the view hierarchy, select it in the editor, and then display its properties in the check bar. The view hierarchy in the modal navigation window shows the relationship between each view and its parent, child, and sibling views.
Note: Selecting an entity in the formula bar is set to a secondary selection set, it is displayed in a lighter color on the view hierarchy. The main selection rally is highlighted in dark colors. These different selection sets can distinguish between the main view (selected on the view hierarchy) and other selected Views (selected in the formula bar) in a complex view hierarchy.
Note: When a custom View object is selected, the secondary editor displays the implementation file. When a system framework provides a view object that is selected, the secondary editor displays the interface file.
- Click the Continue button on the debug bar to exit the view debugger, and then continue running your application in Xcode.
RELATED Links: Xcode 6 View Debugging Tips Xcode View Debugger Detailed view debugging for Xcode 6
Xcode View Debugging