Permalink
Browse files

Adding logging of UIViewController to logging method.

  • Loading branch information...
1 parent 46ae79e commit 47c66f98a4cba444a817e526cc22617caf4732fd Adam McLain committed Apr 24, 2012
@@ -5,6 +5,7 @@
//
#import "DCIntrospect.h"
+#import "UIView+UIVIew_DCIntrospectExtensions.h"
#import <dlfcn.h>
#include <assert.h>
@@ -1441,6 +1442,7 @@ - (void)logPropertiesForObject:(id)object
UIView *view = (UIView *)object;
// print out generic uiview properties
[outputString appendString:@" ** UIView properties **\n"];
+ [outputString appendFormat:@" ViewController: %@\n", [[view firstAvailableUIViewController] class]];
[outputString appendFormat:@" tag: %i\n", view.tag];
[outputString appendFormat:@" frame: %@ | ", NSStringFromCGRect(view.frame)];
[outputString appendFormat:@"bounds: %@ | ", NSStringFromCGRect(view.bounds)];
@@ -52,5 +52,5 @@
#define kDCIntrospectKeysMoveToNextSiblingView @"j"
#define kDCIntrospectKeysMoveToPrevSiblingView @"g"
-#define kDCIntrospectKeysEnterGDB @"`" // enters GDB
-#define kDCIntrospectKeysDisableForPeriod @"~" // disables DCIntrospect for a given period (see kDCIntrospectTemporaryDisableDuration)
+#define kDCIntrospectKeysEnterGDB @"`" // enters GDB
+#define kDCIntrospectKeysDisableForPeriod @"~" // disables DCIntrospect for a given period (see kDCIntrospectTemporaryDisableDuration)
@@ -0,0 +1,13 @@
+//
+// UIView+UIVIew_DCIntrospectExtensions.h
+// DCIntrospectDemo
+//
+// Created by Adam McLain on 4/24/12.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface UIView (UIVIew_DCIntrospectExtensions)
+- (UIViewController *) firstAvailableUIViewController;
+- (id) traverseResponderChainForUIViewController;
+@end
@@ -0,0 +1,27 @@
+//
+// UIView+UIVIew_DCIntrospectExtensions.m
+// DCIntrospectDemo
+//
+// Created by Adam McLain on 4/24/12.
+//
+
+#import "UIView+UIVIew_DCIntrospectExtensions.h"
+
+@implementation UIView (UIVIew_DCIntrospectExtensions)
+
+- (UIViewController *) firstAvailableUIViewController {
+ // convenience function for casting and to "mask" the recursive function
+ return (UIViewController *)[self traverseResponderChainForUIViewController];
+}
+
+- (id) traverseResponderChainForUIViewController {
+ id nextResponder = [self nextResponder];
+ if ([nextResponder isKindOfClass:[UIViewController class]]) {
+ return nextResponder;
+ } else if ([nextResponder isKindOfClass:[UIView class]]) {
+ return [nextResponder traverseResponderChainForUIViewController];
+ } else {
+ return nil;
+ }
+}
+@end
@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
+ 5CF3A57015473DF200590952 /* UIView+UIVIew_DCIntrospectExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 5CF3A56F15473DF200590952 /* UIView+UIVIew_DCIntrospectExtensions.m */; };
625780B0138A052F004DA77B /* circle.png in Resources */ = {isa = PBXBuildFile; fileRef = 625780AF138A052F004DA77B /* circle.png */; };
625780B2138A0EBD004DA77B /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 625780B1138A0EBC004DA77B /* QuartzCore.framework */; };
AB0D01D5136A778000962171 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB0D01D4136A778000962171 /* UIKit.framework */; };
@@ -24,6 +25,8 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
+ 5CF3A56E15473DF200590952 /* UIView+UIVIew_DCIntrospectExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIView+UIVIew_DCIntrospectExtensions.h"; path = "../../DCIntrospect/UIView+UIVIew_DCIntrospectExtensions.h"; sourceTree = "<group>"; };
+ 5CF3A56F15473DF200590952 /* UIView+UIVIew_DCIntrospectExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIView+UIVIew_DCIntrospectExtensions.m"; path = "../../DCIntrospect/UIView+UIVIew_DCIntrospectExtensions.m"; sourceTree = "<group>"; };
625780AF138A052F004DA77B /* circle.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = circle.png; sourceTree = "<group>"; };
625780B1138A0EBC004DA77B /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
AB0D01D0136A778000962171 /* DCIntrospectDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DCIntrospectDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -131,6 +134,8 @@
AB0D021E136A9FE000962171 /* DCFrameView.m */,
ABDA509E136FDD9300339835 /* DCCrossHairView.h */,
ABDA509F136FDD9300339835 /* DCCrossHairView.m */,
+ 5CF3A56E15473DF200590952 /* UIView+UIVIew_DCIntrospectExtensions.h */,
+ 5CF3A56F15473DF200590952 /* UIView+UIVIew_DCIntrospectExtensions.m */,
);
name = DCIntrospect;
sourceTree = "<group>";
@@ -205,6 +210,7 @@
AB0D021F136A9FE000962171 /* DCFrameView.m in Sources */,
ABDA505A136E0FDD00339835 /* DCStatusBarOverlay.m in Sources */,
ABDA50A0136FDD9400339835 /* DCCrossHairView.m in Sources */,
+ 5CF3A57015473DF200590952 /* UIView+UIVIew_DCIntrospectExtensions.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

0 comments on commit 47c66f9

Please sign in to comment.