Permalink
Browse files

Merge pull request #12 from megastep/master

Fix for status bar overlay
  • Loading branch information...
2 parents dd3b429 + 6883548 commit 3470e685178aaca97c552f4b0b5641a96f98c587 @domesticcatsoftware domesticcatsoftware committed Jun 30, 2011
Showing with 29 additions and 8 deletions.
  1. +29 −8 DCIntrospect/DCIntrospect.m
@@ -6,6 +6,7 @@
#import "DCIntrospect.h"
#import <dlfcn.h>
+#import <objc/message.h>
@interface DCIntrospect ()
@@ -62,7 +63,7 @@ + (DCIntrospect *)sharedIntrospector
{
sharedInstance = [[DCIntrospect alloc] init];
sharedInstance.keyboardBindingsOn = YES;
- sharedInstance.showStatusBarOverlay = YES;
+ sharedInstance.showStatusBarOverlay = ![UIApplication sharedApplication].statusBarHidden;
}
#endif
return sharedInstance;
@@ -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}"])
@@ -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];
+ }
}
}

0 comments on commit 3470e68

Please sign in to comment.