View debugging in iOS (iOS8 Apple introduces powerful new technology, it has to be seen)

Source: Internet
Author: User

Before iOS8, we wanted to do real-time UI debugging, and the technical tools we could rely on were:

Start the app with Xcode, then click the Xcode pause button and enter the following statement in the Debug console:

PO [[UIWindow Keywindow] recursivedescription]

You can then see the full UI structure and hierarchical relationships, similar to the following:

<UIWindow:0x7b691cd0; frame = (0 0; 320 480); Gesturerecognizers = <NSArray:0x7b6921f0>; Layer = <UIWindowLayer:0x7b691e00>>

 | <UIView:0x7c078b30; frame = (0 0; 320 480); AutoResize = w+h; Autoresizessubviews = NO; Layer = <CALayer:0x7c078440>>

 |  | <UIView:0x7c078ca0; frame = (10 87; 145 145); AutoResize = RM+BM; Autoresizessubviews = NO; Layer = <CALayer:0x7c0786e0>>

 |  | <UIView:0x7c078f20; frame = (165 87; 145 145); AutoResize = RM+BM; Autoresizessubviews = NO; Layer = <CALayer:0x7c078630>>

 |  | <_UILayoutGuide:0x7c079130; frame = (0 0; 0 20); hidden = YES; Layer = <CALayer:0x7c0792d0>>

|  | <_UILayoutGuide:0x7c079710; frame = (0 480; 0 0); hidden = YES; Layer = <CALayer:0x7c079790>>

PO [self.view recursivedescription] can see the UI structure under the current view, as shown in the following example:

<UIView:0x7ca8ceb0; frame = (0 0; 600 600); AutoResize = RM+BM; Autoresizessubviews = NO; Layer = <CALayer:0x7ca8cb30>>

 | <UIView:0x7ca73890; frame = (10 87; 285 285); AutoResize = RM+BM; Autoresizessubviews = NO; Layer = <CALayer:0x7ca89200>>

 | <UIView:0x7ca7f520; frame = (305 87; 285 285); AutoResize = RM+BM; Autoresizessubviews = NO; Layer = <CALayer:0x7ca7ce70>>

 | <_UILayoutGuide:0x7ca8bd30; frame = (0 0; 0 0); hidden = YES; Layer = <CALayer:0x7ca814d0>>

| <_UILayoutGuide:0x7ca93b20; frame = (0 0; 0 0); hidden = YES; Layer = <CALayer:0x7ca8d530>>

In addition, tools such as reveal can also implement the functionality of the visual analysis UI, which is charged (with a 30-day free trial period).

After Ios8/xcode6, Apple introduced new technical means to support our real-time UI debugging, while running the app using Xcode, press the Debug View Hierarchy button at the bottom, or choose Debug from the menu > View debugging > Capture View Hierarchy to start the debug :



After you start the view debugging, Xcode will take a snapshot of the application's view hierarchy and present a three-dimensional prototype view to explore the level of the user interface. In addition to showing the app's view hierarchy, the three-dimensional view shows the location, order, and view dimensions of each view, as well as how the views interact. The debugging tool is very powerful, combined with the use of storyboard can support the development of iOS page layout adjustment/performance optimization requirements, the specific features here do not expand, please developers in use to summarize and explore.




View debugging in iOS (iOS8 Apple introduces powerful new technology, it has to be seen)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.