Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix iOS6 Deprecations and Floating Point Warnings #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions DCIntrospect/DCFrameView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 4 additions & 2 deletions DCIntrospect/DCIntrospect.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#include <unistd.h>
#include <sys/sysctl.h>

#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

Expand Down Expand Up @@ -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];
}
Expand Down Expand Up @@ -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"];
Expand Down
4 changes: 2 additions & 2 deletions DCIntrospect/DCStatusBarOverlay.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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];
Expand Down