forked from domesticcatsoftware/DCIntrospect
/
DCIntrospect.h
155 lines (117 loc) · 4.68 KB
/
DCIntrospect.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//
// DCIntrospect.h
//
// Created by Domestic Cat on 29/04/11.
//
#define kDCIntrospectNotificationIntrospectionDidStart @"kDCIntrospectNotificationIntrospectionDidStart"
#define kDCIntrospectNotificationIntrospectionDidEnd @"kDCIntrospectNotificationIntrospectionDidEnd"
#define kDCIntrospectAnimationDuration 0.08
#import <objc/runtime.h>
#include "TargetConditionals.h"
#import "DCIntrospectSettings.h"
#import "DCFrameView.h"
#import "DCStatusBarOverlay.h"
#ifdef DEBUG
@interface UIView (debug)
- (NSString *)recursiveDescription;
@end
#endif
@interface DCIntrospect : NSObject <DCFrameViewDelegate, UITextViewDelegate, UIWebViewDelegate>
{
}
@property (nonatomic) BOOL keyboardBindingsOn; // default: YES
@property (nonatomic) BOOL showStatusBarOverlay; // default: YES
@property (nonatomic, retain) UIGestureRecognizer *invokeGestureRecognizer; // default: nil
@property (nonatomic) BOOL on;
@property (nonatomic) BOOL handleArrowKeys;
@property (nonatomic) BOOL viewOutlines;
@property (nonatomic) BOOL highlightNonOpaqueViews;
@property (nonatomic) BOOL flashOnRedraw;
@property (nonatomic, retain) DCFrameView *frameView;
@property (nonatomic, retain) UITextView *inputTextView;
@property (nonatomic, retain) DCStatusBarOverlay *statusBarOverlay;
@property (nonatomic, retain) NSMutableDictionary *objectNames;
@property (nonatomic, assign) UIView *currentView;
@property (nonatomic) CGRect originalFrame;
@property (nonatomic) CGFloat originalAlpha;
@property (nonatomic, retain) NSMutableArray *currentViewHistory;
@property (nonatomic) BOOL showingHelp;
///////////
// Setup //
///////////
+ (DCIntrospect *)sharedIntrospector; // this returns nil when NOT in DEGBUG mode
- (void)start; // NOTE: call setup AFTER [window makeKeyAndVisible] so statusBarOrientation is reported correctly.
////////////////////
// Custom Setters //
////////////////////
- (void)setInvokeGestureRecognizer:(UIGestureRecognizer *)newGestureRecognizer;
- (void)setKeyboardBindingsOn:(BOOL)keyboardBindingsOn;
//////////////////
// Main Actions //
//////////////////
- (void)invokeIntrospector; // can be called manually
- (void)touchAtPoint:(CGPoint)point; // can be called manually
- (void)selectView:(UIView *)view;
- (void)statusBarTapped;
//////////////////////
// Keyboard Capture //
//////////////////////
- (void)textViewDidChangeSelection:(UITextView *)textView;
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)string;
/////////////////////////////////
// Logging Code & Object Names //
/////////////////////////////////
- (void)logCodeForCurrentViewChanges;
// make sure all names that are added are removed at dealloc or else they will be retained here!
- (void)setName:(NSString *)name forObject:(id)object accessedWithSelf:(BOOL)accessedWithSelf;
- (NSString *)nameForObject:(id)object;
- (void)removeNamesForViewsInView:(UIView *)view;
- (void)removeNameForObject:(id)object;
////////////
// Layout //
////////////
- (void)updateFrameView;
- (void)updateStatusBar;
- (void)updateViews;
- (void)showTemporaryStringInStatusBar:(NSString *)string;
/////////////
// Actions //
/////////////
- (void)logRecursiveDescriptionForCurrentView;
- (void)logRecursiveDescriptionForView:(UIView *)view;
- (void)forceSetNeedsDisplay;
- (void)forceSetNeedsLayout;
- (void)forceReloadOfView;
- (void)toggleOutlines;
- (void)addOutlinesToFrameViewFromSubview:(UIView *)view;
- (void)toggleNonOpaqueViews;
- (void)setBackgroundColor:(UIColor *)color ofNonOpaqueViewsInSubview:(UIView *)view;
- (void)toggleRedrawFlashing;
- (void)callDrawRectOnViewsInSubview:(UIView *)subview;
- (void)flashRect:(CGRect)rect inView:(UIView *)view;
/////////////////////////////
// (Somewhat) Experimental //
/////////////////////////////
- (void)logPropertiesForCurrentView;
- (void)logPropertiesForObject:(id)object;
- (void)logAccessabilityPropertiesForObject:(id)object;
- (NSArray *)subclassesOfClass:(Class)parentClass;
/////////////////////////
// Description Methods //
/////////////////////////
- (NSString *)describeProperty:(NSString *)propertyName value:(id)value;
- (NSString *)describeColor:(UIColor *)color;
/////////////////////////
// DCIntrospector Help //
/////////////////////////
- (void)toggleHelp;
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;
////////////////////
// Helper Methods //
////////////////////
- (UIWindow *)mainWindow;
- (NSMutableArray *)viewsAtPoint:(CGPoint)touchPoint inView:(UIView *)view;
- (void)fadeView:(UIView *)view toAlpha:(CGFloat)alpha;
- (BOOL)view:(UIView *)view containsSubview:(UIView *)subview;
- (BOOL)shouldIgnoreView:(UIView *)view;
@end