From e666c6bdc452aa1b8878c36adf964973ded5c946 Mon Sep 17 00:00:00 2001 From: Sean Whitsell Date: Wed, 14 Aug 2013 15:59:00 -0400 Subject: [PATCH] Fix iOS6 Warnings --- DCIntrospect/DCFrameView.m | 4 ++-- DCIntrospect/DCIntrospect.m | 6 ++++-- DCIntrospect/DCStatusBarOverlay.m | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/DCIntrospect/DCFrameView.m b/DCIntrospect/DCFrameView.m index 040fcd9..581f828 100644 --- a/DCIntrospect/DCFrameView.m +++ b/DCIntrospect/DCFrameView.m @@ -36,7 +36,7 @@ - (id)initWithFrame:(CGRect)frame delegate:(id)aDelegate self.touchPointLabel = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease]; 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; @@ -99,7 +99,7 @@ - (void)drawRect:(CGRect)rect BOOL showAntialiasingWarning = NO; if (! CGRectIsEmpty(self.superRect)) { - if ((mainRectOffset.origin.x != floorf(mainRectOffset.origin.x) && mainRect.origin.x != 0) || (mainRectOffset.origin.y != floor(mainRectOffset.origin.y) && mainRect.origin.y != 0)) + if ((mainRectOffset.origin.x != floorf(mainRectOffset.origin.x) && mainRect.origin.x != 0.0) || (mainRectOffset.origin.y != floor(mainRectOffset.origin.y) && mainRect.origin.y != 0.0)) showAntialiasingWarning = YES; } diff --git a/DCIntrospect/DCIntrospect.m b/DCIntrospect/DCIntrospect.m index cc4b4cf..822d5f9 100644 --- a/DCIntrospect/DCIntrospect.m +++ b/DCIntrospect/DCIntrospect.m @@ -13,6 +13,9 @@ #include #include +#define float_epsilon 0.00001 +#define float_equal(a,b) (fabs((a) - (b)) < float_epsilon) + // break into GDB code complied from following sources: // http://blog.timac.org/?p=190, http://developer.apple.com/library/mac/#qa/qa1361/_index.html, http://cocoawithlove.com/2008/03/break-into-debugger.html @@ -654,7 +657,7 @@ - (void)logCodeForCurrentViewChanges [outputString appendFormat:@"%@.frame = CGRectMake(%.1f, %.1f, %.1f, %.1f);\n", varName, self.currentView.frame.origin.x, self.currentView.frame.origin.y, self.currentView.frame.size.width, self.currentView.frame.size.height]; } - if (self.originalAlpha != self.currentView.alpha) + if (!float_equal(self.originalAlpha,self.currentView.alpha)) { [outputString appendFormat:@"%@.alpha = %.2f;\n", varName, self.currentView.alpha]; } @@ -1448,7 +1451,6 @@ - (void)logPropertiesForObject:(id)object [objectString appendFormat:@" autoresizingMask: %@\n", [self describeProperty:@"autoresizingMask" value:[NSNumber numberWithInt:view.autoresizingMask]]]; [objectString appendFormat:@" autoresizesSubviews: %@\n", (view.autoresizesSubviews) ? @"YES" : @"NO"]; [objectString appendFormat:@" contentMode: %@ | ", [self describeProperty:@"contentMode" value:[NSNumber numberWithInt:view.contentMode]]]; - [objectString appendFormat:@"contentStretch: %@\n", NSStringFromCGRect(view.contentStretch)]; [objectString appendFormat:@" backgroundColor: %@\n", [self describeColor:view.backgroundColor]]; [objectString appendFormat:@" alpha: %.2f | ", view.alpha]; [objectString appendFormat:@"opaque: %@ | ", (view.opaque) ? @"YES" : @"NO"]; diff --git a/DCIntrospect/DCStatusBarOverlay.m b/DCIntrospect/DCStatusBarOverlay.m index 7be771e..d538ac5 100644 --- a/DCIntrospect/DCStatusBarOverlay.m +++ b/DCIntrospect/DCStatusBarOverlay.m @@ -43,7 +43,7 @@ - (id)init self.leftLabel = [[[UILabel alloc] initWithFrame:CGRectOffset(self.frame, 2.0f, 0.0f)] autorelease]; 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; @@ -52,7 +52,7 @@ - (id)init self.rightLabel = [[[UILabel alloc] initWithFrame:CGRectOffset(self.frame, -2.0f, 0.0f)] autorelease]; 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];