Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DCIntrospect/DCCrossHairView.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
}

@property (nonatomic, retain) UIColor *color;
@property (nonatomic, strong) UIColor *color;

- (id)initWithFrame:(CGRect)frame color:(UIColor *)aColor;

Expand Down
7 changes: 2 additions & 5 deletions DCIntrospect/DCCrossHairView.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
@implementation DCCrossHairView
@synthesize color;

- (void)dealloc
{
[color release];
[super dealloc];
}


- (id)initWithFrame:(CGRect)frame color:(UIColor *)aColor
{
Expand All @@ -38,6 +34,7 @@ - (void)drawRect:(CGRect)rect
CGContextMoveToPoint(context, 0, floorf(self.bounds.size.height / 2.0f) + 0.5f);
CGContextAddLineToPoint(context, self.bounds.size.width, floorf(self.bounds.size.height / 2.0f) + 0.5f);
CGContextStrokePath(context);

}

@end
6 changes: 3 additions & 3 deletions DCIntrospect/DCFrameView.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
@property (nonatomic, assign) id<DCFrameViewDelegate> delegate;
@property (nonatomic) CGRect mainRect;
@property (nonatomic) CGRect superRect;
@property (nonatomic, retain) UILabel *touchPointLabel;
@property (nonatomic, retain) NSMutableArray *rectsToOutline;
@property (nonatomic, retain) DCCrossHairView *touchPointView;
@property (nonatomic, strong) UILabel *touchPointLabel;
@property (nonatomic, strong) NSMutableArray *rectsToOutline;
@property (nonatomic, strong) DCCrossHairView *touchPointView;

///////////
// Setup //
Expand Down
12 changes: 4 additions & 8 deletions DCIntrospect/DCFrameView.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ @implementation DCFrameView
- (void)dealloc
{
self.delegate = nil;
[touchPointLabel release];
[touchPointView release];

[super dealloc];
}

#pragma mark - Setup
Expand All @@ -33,10 +29,10 @@ - (id)initWithFrame:(CGRect)frame delegate:(id)aDelegate
self.backgroundColor = [UIColor clearColor];
self.opaque = NO;

self.touchPointLabel = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease];
self.touchPointLabel = [[UILabel alloc] initWithFrame:CGRectZero];
self.touchPointLabel.text = @"X 320 Y 480";
self.touchPointLabel.font = [UIFont boldSystemFontOfSize:12.0f];
self.touchPointLabel.textAlignment = UITextAlignmentCenter;
self.touchPointLabel.textAlignment = NSTextAlignmentCenter;
self.touchPointLabel.textColor = [UIColor whiteColor];
self.touchPointLabel.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.65f];
self.touchPointLabel.layer.cornerRadius = 5.5f;
Expand All @@ -46,7 +42,7 @@ - (id)initWithFrame:(CGRect)frame delegate:(id)aDelegate

self.rectsToOutline = [NSMutableArray array];

self.touchPointView = [[[DCCrossHairView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 17.0f, 17.0f) color:[UIColor blueColor]] autorelease];
self.touchPointView = [[DCCrossHairView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 17.0f, 17.0f) color:[UIColor blueColor]];
self.touchPointView.alpha = 0.0f;
[self addSubview:self.touchPointView];
}
Expand Down Expand Up @@ -121,7 +117,7 @@ - (void)drawRect:(CGRect)rect

UIFont *font = [UIFont systemFontOfSize:10.0f];

float dash[2] = {3, 3};
CGFloat dash[2] = {3, 3};
CGContextSetLineDash(context, 0, dash, 2);

// edge->left side
Expand Down
14 changes: 7 additions & 7 deletions DCIntrospect/DCIntrospect.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@

@property (nonatomic) BOOL keyboardBindingsOn; // default: YES
@property (nonatomic) BOOL showStatusBarOverlay; // default: YES
@property (nonatomic, retain) UIGestureRecognizer *invokeGestureRecognizer; // default: nil
@property (nonatomic, strong) 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, strong) DCFrameView *frameView;
@property (nonatomic, strong) UITextView *inputTextView;
@property (nonatomic, strong) DCStatusBarOverlay *statusBarOverlay;

@property (nonatomic, retain) NSMutableDictionary *objectNames;
@property (nonatomic, strong) NSMutableDictionary *objectNames;

@property (nonatomic, assign) UIView *currentView;
@property (nonatomic) CGRect originalFrame;
@property (nonatomic) CGFloat originalAlpha;
@property (nonatomic, retain) NSMutableArray *currentViewHistory;
@property (nonatomic, strong) NSMutableArray *currentViewHistory;

@property (nonatomic) BOOL showingHelp;

Expand Down Expand Up @@ -87,7 +87,7 @@

- (void)logCodeForCurrentViewChanges;

// make sure all names that are added are removed at dealloc or else they will be retained here!
// make sure all names that are added are removed at dealloc or else they will be stronged here!
- (void)setName:(NSString *)name forObject:(id)object accessedWithSelf:(BOOL)accessedWithSelf;
- (NSString *)nameForObject:(id)object;
- (void)removeNamesForViewsInView:(UIView *)view;
Expand Down
80 changes: 41 additions & 39 deletions DCIntrospect/DCIntrospect.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -82,29 +82,29 @@ @implementation DCIntrospect

+ (void)load
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

NSString *simulatorRoot = [[[NSProcessInfo processInfo] environment] objectForKey:@"IPHONE_SIMULATOR_ROOT"];
if (simulatorRoot)
{
void *AppSupport = dlopen([[simulatorRoot stringByAppendingPathComponent:@"/System/Library/PrivateFrameworks/AppSupport.framework/AppSupport"] fileSystemRepresentation], RTLD_LAZY);
CFStringRef (*CPCopySharedResourcesPreferencesDomainForDomain)(CFStringRef domain) = (CFStringRef (*)())dlsym(AppSupport, "CPCopySharedResourcesPreferencesDomainForDomain");
if (CPCopySharedResourcesPreferencesDomainForDomain)
{
CFStringRef accessibilityDomain = CPCopySharedResourcesPreferencesDomainForDomain(CFSTR("com.apple.Accessibility"));
if (accessibilityDomain)
{
// This must be done *before* UIApplicationMain, hence +load
CFPreferencesSetValue(CFSTR("ApplicationAccessibilityEnabled"), kCFBooleanTrue, accessibilityDomain, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
CFRelease(accessibilityDomain);
}
}
}
[pool drain];
@autoreleasepool{
NSString *simulatorRoot = [[[NSProcessInfo processInfo] environment] objectForKey:@"IPHONE_SIMULATOR_ROOT"];
if (simulatorRoot)
{
void *AppSupport = dlopen([[simulatorRoot stringByAppendingPathComponent:@"/System/Library/PrivateFrameworks/AppSupport.framework/AppSupport"] fileSystemRepresentation], RTLD_LAZY);
CFStringRef (*CPCopySharedResourcesPreferencesDomainForDomain)(CFStringRef domain) = (CFStringRef (*)())dlsym(AppSupport, "CPCopySharedResourcesPreferencesDomainForDomain");
if (CPCopySharedResourcesPreferencesDomainForDomain)
{
CFStringRef accessibilityDomain = CPCopySharedResourcesPreferencesDomainForDomain(CFSTR("com.apple.Accessibility"));
if (accessibilityDomain)
{
// This must be done *before* UIApplicationMain, hence +load
CFPreferencesSetValue(CFSTR("ApplicationAccessibilityEnabled"), kCFBooleanTrue, accessibilityDomain, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
CFRelease(accessibilityDomain);
}
}
}
}
}

static void *originalValueForKeyIMPKey = &originalValueForKeyIMPKey;
typedef id (* _rIMP)(id,SEL ,...);

id UITextInputTraits_valueForKey(id self, SEL _cmd, NSString *key);
id UITextInputTraits_valueForKey(id self, SEL _cmd, NSString *key)
Expand All @@ -125,14 +125,15 @@ id UITextInputTraits_valueForKey(id self, SEL _cmd, NSString *key)
}

IMP valueForKey = (IMP)[objc_getAssociatedObject([self class], originalValueForKeyIMPKey) pointerValue];
_rIMP func = (_rIMP)valueForKey;
if ([textInputTraitsProperties containsObject:key])
{
id textInputTraits = valueForKey(self, _cmd, @"textInputTraits");
return valueForKey(textInputTraits, _cmd, key);
id textInputTraits = func(self, _cmd, @"textInputTraits");
return func(textInputTraits, _cmd, key);
}
else
{
return valueForKey(self, _cmd, key);
return func(self, _cmd, key);
}
}

Expand Down Expand Up @@ -186,16 +187,16 @@ - (void)start

if (!self.statusBarOverlay)
{
self.statusBarOverlay = [[[DCStatusBarOverlay alloc] init] autorelease];
self.statusBarOverlay = [[DCStatusBarOverlay alloc] init] ;
}

if (!self.inputTextView)
{
self.inputTextView = [[[UITextView alloc] initWithFrame:CGRectZero] autorelease];
self.inputTextView = [[UITextView alloc] initWithFrame:CGRectZero];
self.inputTextView.delegate = self;
self.inputTextView.autocorrectionType = UITextAutocorrectionTypeNo;
self.inputTextView.autocapitalizationType = UITextAutocapitalizationTypeNone;
self.inputTextView.inputView = [[[UIView alloc] init] autorelease];
self.inputTextView.inputView = [[UIView alloc] init];
self.inputTextView.scrollsToTop = NO;
[mainWindow addSubview:self.inputTextView];
}
Expand Down Expand Up @@ -236,7 +237,7 @@ - (void)start
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateViews) name:UIDeviceOrientationDidChangeNotification object:nil];

if (!self.currentViewHistory)
self.currentViewHistory = [[[NSMutableArray alloc] init] autorelease];
self.currentViewHistory = [[NSMutableArray alloc] init];

NSLog(@"DCIntrospect is setup. %@ to start.", [kDCIntrospectKeysInvoke isEqualToString:@" "] ? @"Push the space bar" : [NSString stringWithFormat:@"Type '%@'", kDCIntrospectKeysInvoke]);
}
Expand All @@ -261,9 +262,8 @@ - (void)setInvokeGestureRecognizer:(UIGestureRecognizer *)newGestureRecognizer
UIWindow *mainWindow = [self mainWindow];
[mainWindow removeGestureRecognizer:invokeGestureRecognizer];

[invokeGestureRecognizer release];
invokeGestureRecognizer = nil;
invokeGestureRecognizer = [newGestureRecognizer retain];
invokeGestureRecognizer = newGestureRecognizer;
[invokeGestureRecognizer addTarget:self action:@selector(invokeIntrospector)];
[mainWindow addGestureRecognizer:invokeGestureRecognizer];
}
Expand Down Expand Up @@ -621,7 +621,7 @@ - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range r
UIView *view = self.currentView;
view.tag = view.tag; // suppress the xcode warning about an unused variable.
NSLog(@"DCIntrospect: access current view using local 'view' variable.");
DEBUGGER;
// DEBUGGER;
return NO;
}

Expand Down Expand Up @@ -659,10 +659,12 @@ - (void)logCodeForCurrentViewChanges
[outputString appendFormat:@"%@.alpha = %.2f;\n", varName, self.currentView.alpha];
}

if (outputString.length == 0)
NSLog(@"DCIntrospect: No changes made to %@.", self.currentView.class);
else
printf("\n\n%s\n", [outputString UTF8String]);
if (outputString.length == 0){
NSLog(@"DCIntrospect: No changes made to %@.", self.currentView.class);
}else{
printf("\n\n%s\n", [outputString UTF8String]);
}

}

- (void)setName:(NSString *)name forObject:(id)object accessedWithSelf:(BOOL)accessedWithSelf
Expand Down Expand Up @@ -730,7 +732,7 @@ - (void)updateFrameView
UIWindow *mainWindow = [self mainWindow];
if (!self.frameView)
{
self.frameView = [[[DCFrameView alloc] initWithFrame:(CGRect){ CGPointZero, mainWindow.frame.size } delegate:self] autorelease];
self.frameView = [[DCFrameView alloc] initWithFrame:(CGRect){ CGPointZero, mainWindow.frame.size } delegate:self];
[mainWindow addSubview:self.frameView];
self.frameView.alpha = 0.0f;
[self updateViews];
Expand Down Expand Up @@ -774,7 +776,7 @@ - (void)updateStatusBar
nameForObject = [nameForObject substringFromIndex:@"self.".length];

if (self.currentView.tag != 0)
self.statusBarOverlay.leftLabel.text = [NSString stringWithFormat:@"%@ (tag: %i)", nameForObject, self.currentView.tag];
self.statusBarOverlay.leftLabel.text = [NSString stringWithFormat:@"%@ (tag: %zd)", nameForObject, self.currentView.tag];
else
self.statusBarOverlay.leftLabel.text = [NSString stringWithFormat:@"%@", nameForObject];

Expand Down Expand Up @@ -1294,13 +1296,13 @@ - (void)toggleHelp
{
self.statusBarOverlay.leftLabel.text = @"Help";
self.statusBarOverlay.rightLabel.text = @"Any key to close";
UIView *backingView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, mainWindow.frame.size.width, mainWindow.frame.size.height)] autorelease];
UIView *backingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, mainWindow.frame.size.width, mainWindow.frame.size.height)];
backingView.tag = 1548;
backingView.alpha = 0;
backingView.backgroundColor = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.85f];
[mainWindow addSubview:backingView];

UIWebView *webView = [[[UIWebView alloc] initWithFrame:backingView.frame] autorelease];
UIWebView *webView = [[UIWebView alloc] initWithFrame:backingView.frame];
webView.opaque = NO;
webView.backgroundColor = [UIColor clearColor];
webView.delegate = self;
Expand Down Expand Up @@ -1560,7 +1562,7 @@ - (NSArray *)subclassesOfClass:(Class)parentClass
int numClasses = objc_getClassList(NULL, 0);
Class *classes = NULL;

classes = malloc(sizeof(Class) * numClasses);
classes = (Class *)malloc(sizeof(Class) * numClasses);
numClasses = objc_getClassList(classes, numClasses);

NSMutableArray *result = [NSMutableArray array];
Expand Down Expand Up @@ -1616,7 +1618,7 @@ - (NSMutableArray *)viewsAtPoint:(CGPoint)touchPoint inView:(UIView *)view
}
}

return [views autorelease];
return views;
}

- (void)fadeView:(UIView *)view toAlpha:(CGFloat)alpha
Expand Down
Empty file modified DCIntrospect/DCIntrospectSettings.h
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions DCIntrospect/DCStatusBarOverlay.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
{
}

@property (nonatomic, retain) UILabel *leftLabel;
@property (nonatomic, retain) UILabel *rightLabel;
@property (nonatomic, strong) UILabel *leftLabel;
@property (nonatomic, strong) UILabel *rightLabel;

///////////
// Setup //
Expand Down
15 changes: 5 additions & 10 deletions DCIntrospect/DCStatusBarOverlay.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ - (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];

[leftLabel release];
[rightLabel release];

[super dealloc];
}

#pragma mark Setup
Expand All @@ -39,25 +35,24 @@ - (id)init
UIImageView *backgroundImageView = [[UIImageView alloc] initWithFrame:self.frame];
backgroundImageView.image = [[UIImage imageNamed:@"statusBarBackground.png"] stretchableImageWithLeftCapWidth:2.0f topCapHeight:0.0f];
[self addSubview:backgroundImageView];
[backgroundImageView release];

self.leftLabel = [[[UILabel alloc] initWithFrame:CGRectOffset(self.frame, 2.0f, 0.0f)] autorelease];
self.leftLabel = [[UILabel alloc] initWithFrame:CGRectOffset(self.frame, 2.0f, 0.0f)];
self.leftLabel.backgroundColor = [UIColor clearColor];
self.leftLabel.textAlignment = UITextAlignmentLeft;
self.leftLabel.textAlignment = NSTextAlignmentLeft;
self.leftLabel.font = [UIFont boldSystemFontOfSize:12.0f];
self.leftLabel.textColor = [UIColor colorWithWhite:0.97f alpha:1.0f];
self.leftLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self addSubview:self.leftLabel];

self.rightLabel = [[[UILabel alloc] initWithFrame:CGRectOffset(self.frame, -2.0f, 0.0f)] autorelease];
self.rightLabel = [[UILabel alloc] initWithFrame:CGRectOffset(self.frame, -2.0f, 0.0f)];
self.rightLabel.backgroundColor = [UIColor clearColor];
self.rightLabel.font = [UIFont boldSystemFontOfSize:12.0f];
self.rightLabel.textAlignment = UITextAlignmentRight;
self.rightLabel.textAlignment = NSTextAlignmentRight;
self.rightLabel.textColor = [UIColor colorWithWhite:0.9f alpha:1.0f];
self.rightLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self addSubview:self.rightLabel];

UITapGestureRecognizer *gestureRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped)] autorelease];
UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped)] ;
[self addGestureRecognizer:gestureRecognizer];

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
Expand Down