How to get the 3D view of UI in Xcode 6?
Run the app. View Debugging works in the simulator and on devices, but it's important to note that it needs to be an iOS 8 simulator or device. That said, you may allow earlier deployment targets in your project, just make sure you run on iOS 8 when you try View Debugging.
Navigate to the screen/view that you want to inspect within the running app.
In the Navigators Panel (left column), select the Debug Navigator (sixth tab). Next to your process, you'll see two buttons – press the rightmost button and select
View UI Hierarchy
.
Alternatively, use the menu:
- Xcode will stop your app and lets you inspect your views. There's no need for you to set a breakpoint, Xcode will do that for you. However, if you want to set a breakpoint manually to inspect local variables etc. alongside your views, you can set a normal breakpoint and once the app pauses, press the View Debugging button in the Debug Area (bottom panel):
How do I inspect the view hierarchy in iOS?
Xcode 6 now has 3D view hierarchy inspection built in like Reveal App and Spark Inspector.
Click on the "Debug View Hierarchy" button while your app is running to pause execution and inspect the views at the current moment.
More info at Apple's documentation.
Xcode - can't find Debug View Hierarchy button
On the left side of the debugger, in the toolbar below:
It is the second icon from the right in the image. It might be black or greyed out depending on whether Xcode is in focus or not.
It works fine on device and simulator. Either click it to break or break using a breakpoint/debugger and use it.
I need to inspect the view hierarchy on an iPhone program
Along the lines of what Yannick suggests, Erica Sadun has code here that pretty-prints the view hierarchy (with class and frame information). You can make this into a UIView category with the following interface:
#import <UIKit/UIKit.h>
@interface UIView (ExploreViews)
- (void)exploreViewAtLevel:(int)level;
@end
and implementation:
#import "UIView+ExploreViews.h"
void doLog(int level, id formatstring,...)
{
int i;
for (i = 0; i < level; i++) printf(" ");
va_list arglist;
if (formatstring)
{
va_start(arglist, formatstring);
id outstring = [[NSString alloc] initWithFormat:formatstring arguments:arglist];
fprintf(stderr, "%s\n", [outstring UTF8String]);
va_end(arglist);
}
}
@implementation UIView (ExploreViews)
- (void)exploreViewAtLevel:(int)level;
{
doLog(level, @"%@", [[self class] description]);
doLog(level, @"%@", NSStringFromCGRect([self frame]));
for (UIView *subview in [self subviews])
[subview exploreViewAtLevel:(level + 1)];
}
@end
why storyboard ui elements not showing on UIViewController in xcode 6?
It looks to me like you are using size class and you went into a particular size class and added these views. Now you are back in Any size class, so the views are not there (that is why they are greyed out in the document outline at the left). They are available only for that particular size class. If you switch back to it again, whatever it was, you will see them again. Basically, you have created conditional views - the condition being that they are present only when that particular size class situation is the case.
In other words, if you want your layout to apply in the general case, you want to start by creating and editing it under Any size classes. Only then do you switch to a particular size class and modify the layout for that particular size class.
when i run my app all ui element visible in my device
Yes, because on your device the particular size class situation matches the size class you were editing when you added those views. So there they are. That seems to me to prove my guess is right.
View shows up in Debug View Hierarchy, but NOT on device/sim
I'm stupid — I fixed it. I'm not sure why it shows up as on top in the view debugger, but it was behind another UIView.
Xcode 6 crash on UI debug
It is bug for new Xcode with old System Maverick. I install new Yosemite and all working on my MacBook 2009.
Related Topics
How to Get Screen Size Using Code on iOS
Implementing Unit Testing with iOS
Uitextview Content Size Different in iOS7
Uicollectionview Select and Deselect Issue
How to Get Current Longitude and Latitude Using Cllocationmanager-Swift
Uicollectionview Sticky Header in Swift
iOS Swift Mapkit Custom Annotation
How to Get Selected Value from Uipickerview
How to Debug "Invalid Bundle" Error Which Happens Only After Submitting to App Store
How to Hide/Show Tabbar When Tapped Using Swift in iOS8
Ios: Place Uiview on Top of Uitableview in Fixed Position
Watch Os 2.0 Beta: Access Heart Beat Rate
How to Change the Size of Uiactivityindicator
Uitextview Starts at Bottom or Middle of the Text
How to Generate an iOS IPA File with Ionic Framework