Skip to content

Commit

Permalink
Merge pull request domesticcatsoftware#12 from megastep/master
Browse files Browse the repository at this point in the history
Fix for status bar overlay
  • Loading branch information
domesticcatsoftware committed Jun 30, 2011
2 parents dd3b429 + 6883548 commit 3470e68
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions DCIntrospect/DCIntrospect.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#import "DCIntrospect.h"
#import <dlfcn.h>
#import <objc/message.h>


@interface DCIntrospect ()
Expand Down Expand Up @@ -62,7 +63,7 @@ + (DCIntrospect *)sharedIntrospector
{
sharedInstance = [[DCIntrospect alloc] init];
sharedInstance.keyboardBindingsOn = YES;
sharedInstance.showStatusBarOverlay = YES;
sharedInstance.showStatusBarOverlay = ![UIApplication sharedApplication].statusBarHidden;
}
#endif
return sharedInstance;
Expand Down Expand Up @@ -1108,10 +1109,16 @@ - (NSString *)describeProperty:(NSString *)propertyName type:(NSString *)type va
}
else if ([type isEqualToString:@"{CGSize=ff}"])
{
NSValue *sizeValue = (NSValue *)value;
if (!sizeValue)
#if TARGET_IPHONE_SIMULATOR
CGSize size = *(CGSize *)value;
if (size.width==0.0f && size.height==0.0f)
return @"CGSizeZero";
#else
if (!value)
return @"CGSizeZero";
NSValue *sizeValue = (NSValue *)value;
CGSize size = [sizeValue CGSizeValue];
#endif
return [NSString stringWithFormat:@"%@", NSStringFromCGSize(size)];
}
else if ([type isEqualToString:@"{UIEdgeInsets=ffff}"])
Expand Down Expand Up @@ -1337,13 +1344,27 @@ - (void)logPropertiesForObject:(id)object
// get the return object and type for the selector
SEL sel = NSSelectorFromString(propertyName);
Method method = class_getInstanceMethod(objectClass, sel);
id returnObject = ([object respondsToSelector:sel]) ? [object performSelector:sel] : nil;
method_getReturnType(method, buffer, buf_size);
NSString *returnType = [NSString stringWithFormat:@"%s", buffer];

[outputString appendFormat:@" %@: ", propertyName];
NSString *propertyDescription = [self describeProperty:propertyName type:returnType value:returnObject];
[outputString appendFormat:@"%@\n", propertyDescription];
if ([object respondsToSelector:sel]) {
id returnObject;
#if TARGET_IPHONE_SIMULATOR
// on x86, 8-byte structs like CGSize are handled differently
if ([returnType isEqualToString:@"{CGSize=ff}"]) {
CGSize (*fptr)(id, SEL) = (CGSize (*)(id, SEL))objc_msgSend;
CGSize ret = fptr(object, sel);
memcpy(buffer, &ret, sizeof(ret));
returnObject = (id)buffer;
} else
#endif
{
returnObject = objc_msgSend(object, sel);
}

[outputString appendFormat:@" %@: ", propertyName];
NSString *propertyDescription = [self describeProperty:propertyName type:returnType value:returnObject];
[outputString appendFormat:@"%@\n", propertyDescription];
}
}
}

Expand Down

0 comments on commit 3470e68

Please sign in to comment.