Browse files

Added documentation for CGUtils.h, NSString+CSS.h, UIDevice+DTVersion.h.

  • Loading branch information...
1 parent e1332e0 commit cfd362bc789c3dc24b5b7a6efb10e88fae148830 @joepasq joepasq committed Feb 18, 2012
Showing with 27 additions and 0 deletions.
  1. +7 −0 Core/Source/CGUtils.h
  2. +16 −0 Core/Source/NSString+CSS.h
  3. +4 −0 Core/Source/UIDevice+DTVersion.h
7 Core/Source/CGUtils.h 100644 → 100755
@@ -6,6 +6,13 @@
// Copyright 2011 All rights reserved.
+//see implementation file for note on deprecation
//CGPathRef newPathForRoundedRect(CGRect rect, CGFloat cornerRadius, BOOL roundTopCorners, BOOL roundBottomCorners);
+/** Determines the new zoom only computing if the sizeToFit is smaller than the originalSize. The zoom scale is computed by whichever resizing scale along the X or Y is smaller preserving the aspect ratio by respecting the axis with more room. The new size is then computed by multipliying the originalSize by that zoom scale.
+ @return New size that fits the sizeToFit while still preserving the aspect ratio of the originalSize. */
CGSize sizeThatFitsKeepingAspectRatio(CGSize originalSize, CGSize sizeToFit);
+/** Convenience method to find the center of a CGRect. Uses CGRectGetMidX and CGRectGetMidY.
+ @return The point which is the center of rect. */
CGPoint CGRectCenter(CGRect rect);
16 Core/Source/NSString+CSS.h 100644 → 100755
@@ -9,11 +9,27 @@
#import "DTCoreText.h"
#import "DTColor+HTML.h"
+/** Methods to make dealing with CSS strings easier. Extract shadows from this string, extract CSS styles found in this string, extract the pixel size of a CSS measurement relative to the current text size, and extract the CSS pixel measurement of this string.
+ */
@interface NSString (CSS)
+/** Examine a string for all CSS styles that are applied to it and return a dictionary of those styles. Implemented using scanCSSAttribute: which is defined in NSScanner+HTML.h.
+ @return A dictionary of strings containing the CSS styles which are applied to this string. */
- (NSDictionary *)dictionaryOfCSSStyles;
+/** Takes a textSize and modifies the current string's pixel measurement to be modified by it. Used in DTHTMLElement.
+ @param textSize The current size which the CSS size is relative to.
+ @return A float that is the size textSize be it %, em or just numbers .*/
- (CGFloat)pixelSizeOfCSSMeasureRelativeToCurrentTextSize:(CGFloat)textSize;
+/** Parse CSS shadow styles, consisting of color, blur, and offset, out of this string. The input string must be comma delimited in the format: <length> <length> <length>? <color>? where the third length and the color are not required per CSS shadows. To calculate the sizes of the blur and offset pixelSizeOfCSSMeasureRelativeToCurrentTextSize is used. Used in DTHTMLElement.
+ @param textSize In order to determine the shadow offset we need what text size it will be displayed at.
+ @param color Used if no shadow attribute color is found.
+ @return An array of dictionaries, each of which is a shadow consisting of color, blur, and offset keys value pairs. */
- (NSArray *)arrayOfCSSShadowsWithCurrentTextSize:(CGFloat)textSize currentColor:(DTColor *)color;
+/** If this string ends with 'px' return the float value stored therein. Ex: The following '17.0px;' will return 17.0. I DON'T KNOW WHAT USES THIS METHOD IF ANYTHING AT ALL-grep returned just this class
+ @return The float value stored in this string. */
- (CGFloat)CSSpixelSize;
4 Core/Source/UIDevice+DTVersion.h 100644 → 100755
@@ -16,8 +16,12 @@ typedef struct
NSInteger point;
} DTVersion;
+/** Convenience method to return the current OS version as a struct of three NSIntegers. Using UIDevice's `currentDevice` method and the current device's `systemVersion` returns a string delimited by a period which can then be split into an array. This method returns a struct storing each value instead of a string or array. Used in DTCoreTextLayoutFrame to workaround the way iOS 4.2 handles images.
+ */
@interface UIDevice (DTVersion)
+ @return Returns a DTVersion struct with three fields each of type NSInteger storing the major, minor, and point numbers identifying this OS version. */
- (DTVersion) osVersion;

0 comments on commit cfd362b

Please sign in to comment.