Skip to content

Commit

Permalink
More documentation. soffes#24 soffes#25
Browse files Browse the repository at this point in the history
  • Loading branch information
soffes committed Jul 8, 2011
1 parent f40b093 commit 072f882
Show file tree
Hide file tree
Showing 48 changed files with 737 additions and 260 deletions.
20 changes: 20 additions & 0 deletions SSToolkit/NSArray+SSToolkitAdditions.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,10 +6,30 @@
// Copyright 2009-2011 Sam Soffes. All rights reserved. // Copyright 2009-2011 Sam Soffes. All rights reserved.
// //


/**
Provides extensions to `NSArray` for various common tasks.
*/
@interface NSArray (SSToolkitAdditions) @interface NSArray (SSToolkitAdditions)


/**
Returns the object in the array with the lowest index value.
@return The object in the array with the lowest index value. If the array is empty, returns `nil`.
*/
- (id)firstObject; - (id)firstObject;

/**
Returns the object in the array with a random index value.
@return The object in the array with a random index value. If the array is empty, returns `nil`.
*/
- (id)randomObject; - (id)randomObject;

/**
Returns a new array with its elements shuffled.
@return A new array containing the receiving array's elements rearranged in a random order.
*/
- (NSArray *)shuffledArray; - (NSArray *)shuffledArray;


@end @end
8 changes: 8 additions & 0 deletions SSToolkit/NSData+SSToolkitAdditions.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@
// Copyright 2008-2011 Sam Soffes. All rights reserved. // Copyright 2008-2011 Sam Soffes. All rights reserved.
// //


/**
Provides extensions to `NSData` for various common tasks.
*/
@interface NSData (SSToolkitAdditions) @interface NSData (SSToolkitAdditions)


/**
Returns a string of the MD5 sum of the receiver.
@return The string of the MD5 sum of the receiver.
*/
- (NSString *)MD5Sum; - (NSString *)MD5Sum;


@end @end
3 changes: 3 additions & 0 deletions SSToolkit/NSDate+SSToolkitAdditions.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// Copyright 2010-2011 Sam Soffes. All rights reserved. // Copyright 2010-2011 Sam Soffes. All rights reserved.
// //


/**
Provides extensions to `NSDate` for various common tasks.
*/
@interface NSDate (SSToolkitAdditions) @interface NSDate (SSToolkitAdditions)


+ (NSDate *)dateFromISO8601String:(NSString *)string; + (NSDate *)dateFromISO8601String:(NSString *)string;
Expand Down
3 changes: 3 additions & 0 deletions SSToolkit/NSDictionary+SSToolkitAdditions.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// Copyright 2010-2011 Sam Soffes. All rights reserved. // Copyright 2010-2011 Sam Soffes. All rights reserved.
// //


/**
Provides extensions to `NSDictionary` for various common tasks.
*/
@interface NSDictionary (SSToolkitAdditions) @interface NSDictionary (SSToolkitAdditions)


+ (NSDictionary *)dictionaryWithFormEncodedString:(NSString *)encodedString; + (NSDictionary *)dictionaryWithFormEncodedString:(NSString *)encodedString;
Expand Down
3 changes: 3 additions & 0 deletions SSToolkit/NSString+SSToolkitAdditions.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// Copyright 2009-2011 Sam Soffes. All rights reserved. // Copyright 2009-2011 Sam Soffes. All rights reserved.
// //


/**
Provides extensions to `NSString` for various common tasks.
*/
@interface NSString (SSToolkitAdditions) @interface NSString (SSToolkitAdditions)


- (BOOL)containsString:(NSString *)string; - (BOOL)containsString:(NSString *)string;
Expand Down
3 changes: 3 additions & 0 deletions SSToolkit/NSURL+SSToolkitAdditions.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// Copyright 2010-2011 Sam Soffes. All rights reserved. // Copyright 2010-2011 Sam Soffes. All rights reserved.
// //


/**
Provides extensions to `NSURL` for various common tasks.
*/
@interface NSURL (SSToolkitAdditions) @interface NSURL (SSToolkitAdditions)


- (NSDictionary *)queryDictionary; - (NSDictionary *)queryDictionary;
Expand Down
4 changes: 2 additions & 2 deletions SSToolkit/SSAddressBarTextField.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ - (id)initWithFrame:(CGRect)aFrame {
UIButton *aReloadButton = [UIButton buttonWithType:UIButtonTypeCustom]; UIButton *aReloadButton = [UIButton buttonWithType:UIButtonTypeCustom];
aReloadButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; aReloadButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
aReloadButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; aReloadButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
[aReloadButton setImage:[UIImage imageNamed:@"SSAddressBarTextFieldReload.png" bundle:kSSToolkitBundleName] forState:UIControlStateNormal]; [aReloadButton setImage:[UIImage imageNamed:@"SSAddressBarTextFieldReload.png" bundleName:kSSToolkitBundleName] forState:UIControlStateNormal];
self.reloadButton = aReloadButton; self.reloadButton = aReloadButton;
self.rightView = _reloadButton; self.rightView = _reloadButton;


// Stop button // Stop button
UIButton *aStopButton = [UIButton buttonWithType:UIButtonTypeCustom]; UIButton *aStopButton = [UIButton buttonWithType:UIButtonTypeCustom];
aStopButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; aStopButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
aStopButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; aStopButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
[aStopButton setImage:[UIImage imageNamed:@"SSAddressBarTextFieldStop.png" bundle:kSSToolkitBundleName] forState:UIControlStateNormal]; [aStopButton setImage:[UIImage imageNamed:@"SSAddressBarTextFieldStop.png" bundleName:kSSToolkitBundleName] forState:UIControlStateNormal];
self.stopButton = aStopButton; self.stopButton = aStopButton;


self.loading = NO; self.loading = NO;
Expand Down
2 changes: 1 addition & 1 deletion SSToolkit/SSAddressBarTextFieldBackgroundViewInnerView.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ - (id)initWithFrame:(CGRect)aFrame {


- (void)drawRect:(CGRect)rect { - (void)drawRect:(CGRect)rect {
CGSize size = self.frame.size; CGSize size = self.frame.size;
[[UIImage imageNamed:@"SSAddressBarTextFieldBackground.png" bundle:kSSToolkitBundleName] drawAsPatternInRect:CGRectMake(0.0f, 0.0f, size.width, size.height)]; [[UIImage imageNamed:@"SSAddressBarTextFieldBackground.png" bundleName:kSSToolkitBundleName] drawAsPatternInRect:CGRectMake(0.0f, 0.0f, size.width, size.height)];
} }


@end @end
53 changes: 47 additions & 6 deletions SSToolkit/SSAnimatedImageView.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@


@protocol SSAnimatedImageViewDelegate; @protocol SSAnimatedImageViewDelegate;


/** Animated image view. /**
Animated image view.
`SSAnimatedImageView` is a simple subclass of `UIImageView` that provides more advanced control of image animations. `SSAnimatedImageView` is a simple subclass of `UIImageView` that provides more advanced control of image animations.
The animation is backed by a `CAKeyframeAnimation`. The animation is backed by a `CAKeyframeAnimation`.
Expand All @@ -21,23 +22,31 @@
/// @name Starting Animations /// @name Starting Animations
///-------------------------- ///--------------------------


/** Start an image animation. /**
Start an image animation.
@param animationName The named of the animation. @param animationName The named of the animation.
@param images An array of `UIImage` objects that will be animated. @param images An array of `UIImage` objects that will be animated.
@param delegate The delegate of the animation. @param delegate The delegate of the animation.
The duration is set to the appropriate length for playing the images at 30fps. The duration is set to the appropriate length for playing the images at 30fps.
*/ */
- (void)startImageAnimation:(NSString *)animationName images:(NSArray *)images delegate:(id<SSAnimatedImageViewDelegate>)delegate; - (void)startImageAnimation:(NSString *)animationName images:(NSArray *)images delegate:(id<SSAnimatedImageViewDelegate>)delegate;




/** Start an image animation with duration and repeat count. /**
Start an image animation with duration and repeat count.
@param animationName The named of the animation. @param animationName The named of the animation.
@param images An array of `UIImage` objects that will be animated. @param images An array of `UIImage` objects that will be animated.
@param duration The duration of the animation. @param duration The duration of the animation.
@param repeatCount The number of times the animation repeats. Specify `0` to repeat indefinitely. @param repeatCount The number of times the animation repeats. Specify `0` to repeat indefinitely.
@param delegate The delegate of the animation. @param delegate The delegate of the animation.
*/ */
- (void)startImageAnimation:(NSString *)animationName images:(NSArray *)images duration:(NSTimeInterval)duration repeatCount:(NSUInteger)repeatCount delegate:(id<SSAnimatedImageViewDelegate>)delegate; - (void)startImageAnimation:(NSString *)animationName images:(NSArray *)images duration:(NSTimeInterval)duration repeatCount:(NSUInteger)repeatCount delegate:(id<SSAnimatedImageViewDelegate>)delegate;
Expand All @@ -46,12 +55,17 @@
/// @name Starting Timed Animations /// @name Starting Timed Animations
///-------------------------------- ///--------------------------------


/** Start a timed image animation with repeat count. /**
Start a timed image animation with repeat count.
@param animationName The named of the animation. @param animationName The named of the animation.
@param images An array of `UIImage` objects that will be animated. @param images An array of `UIImage` objects that will be animated.
@param keyTimes An array of `NSNumber` objects that define the duration of each keyframe segment. @param keyTimes An array of `NSNumber` objects that define the duration of each keyframe segment.
@param repeatCount The number of times the animation repeats. Specify `0` to repeat indefinitely. @param repeatCount The number of times the animation repeats. Specify `0` to repeat indefinitely.
@param delegate The delegate of the animation. @param delegate The delegate of the animation.
See `CAKeyframeAnimation`'s documentation for more information on how to specify `keyTimes`. See `CAKeyframeAnimation`'s documentation for more information on how to specify `keyTimes`.
Expand All @@ -61,11 +75,38 @@
@end @end




/**
The `SSAnimatedImageViewDelegate` protocol defines methods that a delegate of a `SSAnimatedImageView` object can
optionally implement to observe the animation status.
@warning **Important:** Before releasing an instance of `SSAnimatedImageView` for which you have set a delegate, you
must first set the `SSAnimatedImageView` delegate property to `nil` before disposing of the `SSAnimatedImageView`
instance. This can be done, for example, in the `dealloc` method where you dispose of the `SSAnimatedImageView`.
*/
@protocol SSAnimatedImageViewDelegate <NSObject> @protocol SSAnimatedImageViewDelegate <NSObject>


@optional @optional


- (void)imageView:(SSAnimatedImageView *)imageView didStartAnimation:(NSString *)animationName; /**
- (void)imageView:(SSAnimatedImageView *)imageView didFinishAnimation:(NSString *)animationName; Sent when an image view begins playing its animation.
@param anImageView The image view that started playng its animation.
@param animationName The name of the animation that started.
@see imageView:didFinishAnimation:
*/
- (void)imageView:(SSAnimatedImageView *)anImageView didStartAnimation:(NSString *)animationName;

/**
Sent after an image view finished playing its animation.
@param anImageView The image view that finished playng its animation.
@param animationName The name of the animation that started.
@see imageView:didStartAnimation:
*/
- (void)imageView:(SSAnimatedImageView *)anImageView didFinishAnimation:(NSString *)animationName;


@end @end
8 changes: 6 additions & 2 deletions SSToolkit/SSBadgeTableViewCell.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@


@class SSBadgeView; @class SSBadgeView;


/// Table view cell that displays a `SSBadgeView` as its accessory. /**
Table view cell that displays a `SSBadgeView` as its accessory.
*/
@interface SSBadgeTableViewCell : UITableViewCell { @interface SSBadgeTableViewCell : UITableViewCell {


@private @private


SSBadgeView *_badgeView; SSBadgeView *_badgeView;
} }


/// A view that indicates some status to the user. (read-only) /**
A view that indicates some status to the user. (read-only)
*/
@property (nonatomic, retain, readonly) SSBadgeView *badgeView; @property (nonatomic, retain, readonly) SSBadgeView *badgeView;


@end @end
31 changes: 21 additions & 10 deletions SSToolkit/SSBadgeView.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ typedef enum {


@class SSLabel; @class SSLabel;


/** Badge view. /**
Badge view.
Provides the accesory view for a SSBadgeTableViewCell, available through the `badgeView` property. Provides the accesory view for a SSBadgeTableViewCell, available through the `badgeView` property.
Expand All @@ -41,42 +42,49 @@ typedef enum {
/// @name Accessing the Badge Label /// @name Accessing the Badge Label
///-------------------------------- ///--------------------------------


/// The badge text label. /**
The badge text label.
*/
@property (nonatomic, retain, readonly) SSLabel *textLabel; @property (nonatomic, retain, readonly) SSLabel *textLabel;


///------------------------------------- ///-------------------------------------
/// @name Accessing the Badge Attributes /// @name Accessing the Badge Attributes
///------------------------------------- ///-------------------------------------


/** The badge's background color. /**
The badge's background color.
The default value of this property is grayish blue (that matches Mail.app). The default value of this property is grayish blue (that matches Mail.app).
@see defaultBadgeColor @see defaultBadgeColor
*/ */
@property (nonatomic, retain) UIColor *badgeColor; @property (nonatomic, retain) UIColor *badgeColor;


/** The badge's background color while its cell is highlighted. /**
The badge's background color while its cell is highlighted.
The default value of this property is white. The default value of this property is white.
*/ */
@property (nonatomic, retain) UIColor *highlightedBadgeColor; @property (nonatomic, retain) UIColor *highlightedBadgeColor;


/** The corner radius used when rendering the badge's outline. /**
The corner radius used when rendering the badge's outline.
The default value of this property is 10. The default value of this property is 10.
*/ */
@property (nonatomic, assign) CGFloat cornerRadius; @property (nonatomic, assign) CGFloat cornerRadius;


/** The badge's horizontal alignment within the accesoryView frame. /**
The badge's horizontal alignment within the accesoryView frame.
This will position the badge in the view's bounds accordinly. This will position the badge in the view's bounds accordinly.
The default value of this property is `SSBadgeViewAlignmentCenter`. The default value of this property is `SSBadgeViewAlignmentCenter`.
*/ */
@property (nonatomic, assign) SSBadgeViewAlignment badgeAlignment; @property (nonatomic, assign) SSBadgeViewAlignment badgeAlignment;


/** A Boolean value indicating whether the receiver should be drawn with a highlight. /**
A Boolean value indicating whether the receiver should be drawn with a highlight.
Setting this property causes the receiver to redraw with the appropriate highlight state. Setting this property causes the receiver to redraw with the appropriate highlight state.
Expand All @@ -88,15 +96,17 @@ typedef enum {
/// @name Drawing Images /// @name Drawing Images
///--------------------- ///---------------------


/** The badge's background image. /**
The badge's background image.
The default value of this property is `nil`. If the value is non-nil, it will be draw instead of the color. The default value of this property is `nil`. If the value is non-nil, it will be draw instead of the color.
Setting a strechable image for this property is recommended. Setting a strechable image for this property is recommended.
*/ */
@property (nonatomic, retain) UIImage *badgeImage; @property (nonatomic, retain) UIImage *badgeImage;


/** The badge's background image while its cell is highlighted. /**
The badge's background image while its cell is highlighted.
The default value of this property is `nil`. If the value is non-nil, it will be draw instead of the color. The default value of this property is `nil`. If the value is non-nil, it will be draw instead of the color.
Expand All @@ -108,7 +118,8 @@ typedef enum {
/// @name Defaults /// @name Defaults
///--------------- ///---------------


/** The default badge color. /**
The default badge color.
@return A color with its value set to the default badge color. @return A color with its value set to the default badge color.
*/ */
Expand Down
16 changes: 11 additions & 5 deletions SSToolkit/SSBordererView.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
// Copyright 2011 Sam Soffes. All rights reserved. // Copyright 2011 Sam Soffes. All rights reserved.
// //


/// Simple UIView for drawing top and bottom borders with optional insets in a view. /**
Simple UIView for drawing top and bottom borders with optional insets in a view.
*/
@interface SSBordererView : UIView { @interface SSBordererView : UIView {


@private @private
Expand All @@ -21,13 +23,15 @@
/// @name Drawing the Top Border /// @name Drawing the Top Border
///----------------------------- ///-----------------------------


/** The top border color. The default is `nil`. /**
The top border color. The default is `nil`.
@see bottomBorderColor @see bottomBorderColor
*/ */
@property (nonatomic, retain) UIColor *topBorderColor; @property (nonatomic, retain) UIColor *topBorderColor;


/** The top inset color. The default is `nil`. /**
The top inset color. The default is `nil`.
@see bottomInsetColor @see bottomInsetColor
*/ */
Expand All @@ -37,13 +41,15 @@
/// @name Drawing the Bottom Border /// @name Drawing the Bottom Border
///-------------------------------- ///--------------------------------


/** The bottom inset color. The default is `nil`. /**
The bottom inset color. The default is `nil`.
@see topInsetColor @see topInsetColor
*/ */
@property (nonatomic, retain) UIColor *bottomInsetColor; @property (nonatomic, retain) UIColor *bottomInsetColor;


/** The bottom border color. The default is `nil`. /**
The bottom border color. The default is `nil`.
@see topBorderColor @see topBorderColor
*/ */
Expand Down
Loading

0 comments on commit 072f882

Please sign in to comment.