Skip to content

Commit

Permalink
Merge pull request #56 from peng90/master
Browse files Browse the repository at this point in the history
Add HeaderDoc style documentations.
  • Loading branch information
Tangdixi committed May 16, 2016
2 parents b8b4c07 + 75b9fb5 commit 6a15f04
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 11 deletions.
123 changes: 121 additions & 2 deletions DCPathButton/Classes/DCPathButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,63 +14,182 @@

@class DCPathButton;

/*!
* The direction of a `DCPathButton` object's bloom animation.
*/
typedef NS_ENUM(NSUInteger, kDCPathButtonBloomDirection) {

/*!
* Bloom animation gose to the top of the `DCPathButton` object.
*/
kDCPathButtonBloomDirectionTop = 1,
/*!
* Bloom animation gose to top left of the `DCPathButton` object.
*/
kDCPathButtonBloomDirectionTopLeft = 2,
/*!
* Bloom animation gose to the left of the `DCPathButton` object.
*/
kDCPathButtonBloomDirectionLeft = 3,
/*!
* Bloom animation gose to bottom left of the `DCPathButton` object.
*/
kDCPathButtonBloomDirectionBottomLeft = 4,
/*!
* Bloom animation gose to the bottom of the `DCPathButton` object.
*/
kDCPathButtonBloomDirectionBottom = 5,
/*!
* Bloom animation gose to bottom right of the `DCPathButton` object.
*/
kDCPathButtonBloomDirectionBottomRight = 6,
/*!
* Bloom animation gose to the right of the `DCPathButton` object.
*/
kDCPathButtonBloomDirectionRight = 7,
/*!
* Bloom animation gose around the `DCPathButton` object.
*/
kDCPathButtonBloomDirectionTopRight = 8,

};

/*!
* `DCPathButtonDelegate` protocol defines methods that inform the delegate object the events of item button's selection, presentation and dismissal.
*/
@protocol DCPathButtonDelegate <NSObject>

/*!
* Tells the delegate that the item button at an index is clicked.
*
* @param dcPathButton A `DCPathButton` object informing the delegate about the button click.
* @param itemButtonIndex The index of the item button being clicked.
*/
- (void)pathButton:(DCPathButton *)dcPathButton clickItemButtonAtIndex:(NSUInteger)itemButtonIndex;

@optional

/*!
* Tells the delegate that the `DCPathButton` object will present its items.
*
* @param dcPathButton A `DCPathButton` object that is about to present its items.
*/
- (void)willPresentDCPathButtonItems:(DCPathButton *)dcPathButton;
/*!
* Tells the delegate that the `DCPathButton` object has already presented its items.
*
* @param dcPathButton A `DCPathButton` object that has presented its items.
*/
- (void)didPresentDCPathButtonItems:(DCPathButton *)dcPathButton;

/*!
* Tells the delegate that the `DCPathButton` object will dismiss its items.
*
* @param dcPathButton A `DCPathButton` object that is about to dismiss its items
*/
- (void)willDismissDCPathButtonItems:(DCPathButton *)dcPathButton;
/*!
* Tells the delegate that the `DCPathButton` object has already dismissed its items.
*
* @param dcPathButton A `DCPathButton` object that has dismissed its items.
*/
- (void)didDismissDCPathButtonItems:(DCPathButton *)dcPathButton;

@end

@interface DCPathButton : UIView <UIGestureRecognizerDelegate>

/*!
* The object that acts as the delegate of the `DCPathButton` object.
*/
@property (weak, nonatomic) id<DCPathButtonDelegate> delegate;

/*!
* `DCPathButton` object's bloom animation's duration.
*/
@property (assign, nonatomic) NSTimeInterval basicDuration;
/*!
* `YES` if allows `DCPathButton` object's sub items to rotate. Otherwise `NO`.
*/
@property (assign, nonatomic) BOOL allowSubItemRotation;

/*!
* `DCPathButton` object's bloom radius. The default value is 105.0f.
*/
@property (assign, nonatomic) CGFloat bloomRadius;

/*!
* `DCPathButton` object's bloom angle.
*/
@property (assign, nonatomic) CGFloat bloomAngel;

/*!
* The center of a `DCPathButton` object's position. The default value positions the `DCPathButton` object in bottom center.
*/
@property (assign, nonatomic) CGPoint dcButtonCenter;

/*!
* If set to `YES` a sound will be played when the `DCPathButton` object is being interacted. The default value is `YES`.
*/
@property (assign, nonatomic) BOOL allowSounds;

/*!
* The path to the `DCPathButton` object's bloom effect sound file.
*/
@property (copy, nonatomic) NSString *bloomSoundPath;

/*!
* The path to the `DCPathButton` object's fold effect sound file.
*/
@property (copy, nonatomic) NSString *foldSoundPath;

/*!
* The path to the `DCPathButton` object's item action sound file.
*/
@property (copy, nonatomic) NSString *itemSoundPath;

/*!
* `YES` if allows the `DCPathButton` object's center button to rotate. Otherwise `NO`.
*/
@property (assign, nonatomic) BOOL allowCenterButtonRotation;

/*!
* Color of the backdrop view when `DCPathButton` object's sub items are shown.
*/
@property (strong, nonatomic) UIColor *bottomViewColor;

/*!
* Direction of `DCPathButton` object's bloom animation.
*/
@property (assign, nonatomic) kDCPathButtonBloomDirection bloomDirection;

/*!
* Creates a `DCPathButton` object with a given normal image and highlited images for center button.
*
* @param centerImage The normal image for `DCPathButton` object's center button.
* @param centerHighlightedImage The highlighted image for `DCPathButton` object's center button.
*
* @return A `DCPathButton` object.
*/
- (instancetype)initWithCenterImage:(UIImage *)centerImage
highlightedImage:(UIImage *)centerHighlightedImage;

/*!
* Creates a `DCPathButton` object with a given frame, normal and highlighted images for its center button.
*
* @param centerButtonFrame The frame of `DCPathButton` object.
* @param centerImage The normal image for `DCPathButton` object's center button.
* @param centerHighlightedImage The highlighted image for `DCPathButton` object's center button.
*
* @return A `DCPathButton` object.
*/
- (instancetype)initWithButtonFrame:(CGRect)centerButtonFrame
centerImage:(UIImage *)centerImage
highlightedImage:(UIImage *)centerHighlightedImage;

/*!
* Adds item buttons to an existing `DCPathButton` object.
*
* @param pathItemButtons The item buttons to be added.
*/
- (void)addPathItems:(NSArray *)pathItemButtons;

@end
25 changes: 25 additions & 0 deletions DCPathButton/Classes/DCPathItemButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,42 @@

@class DCPathItemButton;

/*!
* `DCPathItemButtonDelegate` protocol defines method that informs the delegate object the event of item button's selection.
*/
@protocol DCPathItemButtonDelegate <NSObject>

/*!
* Tells the delegate that the `DCPathItemButton` has been selected.
*
* @param itemButton A `DCPathItemButton` that has been selected.
*/
- (void)itemButtonTapped:(DCPathItemButton *)itemButton;

@end

@interface DCPathItemButton : UIButton

/*!
* The location of the `DCPathItemButton` object in a `DCPathButton` object.
*/
@property (assign, nonatomic) NSUInteger index;

/*!
* The object that acts as the delegate of the `DCPathItemButton` object.
*/
@property (weak, nonatomic) id<DCPathItemButtonDelegate> delegate;

/*!
* Creates a `DCPathItemButton` with normal and highlighted foreground and background images of the button.
*
* @param image The normal foreground image.
* @param highlightedImage The highlighted foreground image.
* @param backgroundImage The normal background image.
* @param backgroundHighlightedImage The highlighted background image.
*
* @return A `DCPathItemButton` object.
*/
- (instancetype)initWithImage:(UIImage *)image
highlightedImage:(UIImage *)highlightedImage
backgroundImage:(UIImage *)backgroundImage
Expand Down
11 changes: 8 additions & 3 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

/* Begin PBXBuildFile section */
0D964741D00C43C7F00D3507 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14DD23BAC82943B6BA709779 /* libPods.a */; };
43F4EFF81BE0B65B00FC8D9A /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 43F4EFF71BE0B65B00FC8D9A /* Default-568h@2x.png */; settings = {ASSET_TAGS = (); }; };
43F4EFFE1BE70BAF00FC8D9A /* BarButtonItemViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 43F4EFFD1BE70BAF00FC8D9A /* BarButtonItemViewController.m */; settings = {ASSET_TAGS = (); }; };
43F4EFF81BE0B65B00FC8D9A /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 43F4EFF71BE0B65B00FC8D9A /* Default-568h@2x.png */; };
43F4EFFE1BE70BAF00FC8D9A /* BarButtonItemViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 43F4EFFD1BE70BAF00FC8D9A /* BarButtonItemViewController.m */; };
810D19761B41293E0032125D /* TabBarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 810D19751B41293E0032125D /* TabBarViewController.m */; };
810D19791B412DCF0032125D /* UIScrollViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 810D19781B412DCF0032125D /* UIScrollViewController.m */; };
81696CC91999D748001B9B4B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81696CC81999D748001B9B4B /* Foundation.framework */; };
Expand Down Expand Up @@ -232,7 +232,7 @@
81696CBD1999D748001B9B4B /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = Tangdxi;
TargetAttributes = {
81696CE51999D748001B9B4B = {
Expand Down Expand Up @@ -392,6 +392,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -452,6 +453,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Example/Example-Prefix.pch";
INFOPLIST_FILE = "Example/Example-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "DC.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
Expand All @@ -465,6 +467,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Example/Example-Prefix.pch";
INFOPLIST_FILE = "Example/Example-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "DC.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
Expand All @@ -486,6 +489,7 @@
"$(inherited)",
);
INFOPLIST_FILE = "ExampleTests/ExampleTests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "DC.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
Expand All @@ -504,6 +508,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Example/Example-Prefix.pch";
INFOPLIST_FILE = "ExampleTests/ExampleTests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "DC.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
Expand Down
5 changes: 5 additions & 0 deletions Example/Example/BarButtonItemViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,9 @@ - (void)viewDidLoad {

}

#pragma mark - DCPathButtonDelegate
- (void)pathButton:(DCPathButton *)dcPathButton clickItemButtonAtIndex:(NSUInteger)itemButtonIndex {
NSLog(@"You tap %@ at index : %tu", dcPathButton, itemButtonIndex);
}

@end
6 changes: 3 additions & 3 deletions Example/Example/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="CCu-8x-tJZ">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="CCu-8x-tJZ">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Main View Controller-->
Expand Down Expand Up @@ -251,7 +251,7 @@
<!--Scroll View Controller-->
<scene sceneID="yoK-VB-pbE">
<objects>
<viewController id="uUX-tx-Zhe" customClass="UIScrollViewController" sceneMemberID="viewController">
<viewController storyboardIdentifier="ScrollViewController" id="uUX-tx-Zhe" customClass="UIScrollViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="7Un-Zd-Tvj"/>
<viewControllerLayoutGuide type="bottom" id="jYb-SN-rSe"/>
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/Example-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>DC.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/TabBarViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ - (void)willPresentDCPathButtonItems:(DCPathButton *)dcPathButton {
}

- (void)pathButton:(DCPathButton *)dcPathButton clickItemButtonAtIndex:(NSUInteger)itemButtonIndex {
NSLog(@"You tap %@ at index : %lu", dcPathButton, (unsigned long)itemButtonIndex);
NSLog(@"You tap %@ at index : %tu", dcPathButton, itemButtonIndex);
}

- (void)didPresentDCPathButtonItems:(DCPathButton *)dcPathButton {
Expand Down
2 changes: 1 addition & 1 deletion Example/ExampleTests/ExampleTests-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>DC.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
Expand Down

0 comments on commit 6a15f04

Please sign in to comment.