Skip to content

Commit

Permalink
Suppress a deprecation warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdee committed Apr 2, 2014
1 parent 103aebf commit 9fb182b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion IOSKnobControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#define IKC_VERSION_STRING @"1.1.0"
#define IKC_VERSION 0x010100
#define IKC_BUILD 1
#define IKC_BUILD 2

/**
* @mainpage iOS Knob Control
Expand Down
10 changes: 8 additions & 2 deletions IOSKnobControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

// Must match IKC_VERSION and IKC_BUILD from IOSKnobControl.h.
#define IKC_TARGET_VERSION 0x010100
#define IKC_TARGET_BUILD 1
#define IKC_TARGET_BUILD 2

/*
* DEBT: Should also do a runtime check in the constructors in case the control is ever built
Expand All @@ -40,6 +40,10 @@ static float normalizePosition(float position) {
return position;
}

@protocol NSStringDeprecatedMethods
- (CGSize) sizeWithFont:(UIFont*)font;
@end

@interface NSString(IKC)
- (CGSize)sizeOfTextWithFontSize:(CGFloat)fontSize;
@end
Expand All @@ -62,7 +66,9 @@ - (CGSize)sizeOfTextWithFontSize:(CGFloat)fontSize
}
else {
// iOS 5 & 6
textSize = [self sizeWithFont:font];
// following http://vgable.com/blog/2009/06/15/ignoring-just-one-deprecated-warning/
id<NSStringDeprecatedMethods> string = (id<NSStringDeprecatedMethods>)self;
textSize = [string sizeWithFont:font];
}
return textSize;
}
Expand Down

0 comments on commit 9fb182b

Please sign in to comment.