Skip to content

Commit

Permalink
renamed block properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Johnson committed Jul 6, 2013
1 parent 0c58618 commit 22be3a2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions JNJProgressButton-Sample/JNJSampleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ - (void)viewDidLoad
self.progressButton2.endButtonImage = [UIImage imageNamed:@"06-magnify"];

__weak typeof(self) weak_self = self;
self.progressButton2.startButtonWasTapped = ^(JNJProgressButton *button) {
self.progressButton2.startButtonDidTapBlock = ^(JNJProgressButton *button) {
NSLog(@"Start button was tapped. From the block.");
[weak_self startProgressWithButton:button];
};
self.progressButton2.endButtonWasTapped = ^(JNJProgressButton *button) {
self.progressButton2.endButtonDidTapBlock = ^(JNJProgressButton *button) {
NSLog(@"End button was tapped. From the block.");
};
self.progressButton2.progressCanceled = ^(JNJProgressButton *button) {
self.progressButton2.progressDidCancelBlock = ^(JNJProgressButton *button) {
NSLog(@"Progress Cancelled. From the block.");
};
}
Expand Down
6 changes: 3 additions & 3 deletions JNJProgressButton/JNJProgressButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ typedef void(^JNJProgressButtonBlockAction)(JNJProgressButton *button);

/** Invoked when the progress button is tapped for the first time, the equivalent of -[JNJProgressButtonDelegate progressButtonStartButtonTapped:].
*/
@property (nonatomic, copy) JNJProgressButtonBlockAction startButtonWasTapped;
@property (nonatomic, copy) JNJProgressButtonBlockAction startButtonDidTapBlock;

/** Invoked when the progress button is tapped after progress has occurred, the equivalent of -[JNJProgressButtonDelegate progressButtonEndButtonTapped:].
*/
@property (nonatomic, copy) JNJProgressButtonBlockAction endButtonWasTapped;
@property (nonatomic, copy) JNJProgressButtonBlockAction endButtonDidTapBlock;

/** Invoked when the progress button is tapped while progressing, the equivalent of -[JNJProgressButtonDelegate progressButtonDidCancelProgress:].
*/
@property (nonatomic, copy) JNJProgressButtonBlockAction progressCanceled;
@property (nonatomic, copy) JNJProgressButtonBlockAction progressDidCancelBlock;

/** Set the current progress of the button
@param progress The float value of the progress from 0.0 to 1.0. Values outside of this are pinned.
Expand Down
12 changes: 6 additions & 6 deletions JNJProgressButton/JNJProgressButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ - (void)progressButtonWasTapped:(UIGestureRecognizer *)gestureRecognizer
[self.delegate progressButtonStartButtonTapped:self];
}

if (self.startButtonWasTapped) {
self.startButtonWasTapped(self);
if (self.startButtonDidTapBlock) {
self.startButtonDidTapBlock(self);
}
} else if (self.state == JNJProgressButtonStateProgressing) {
[self endProgressWithState:JNJProgressButtonStateUnstarted];
Expand All @@ -221,16 +221,16 @@ - (void)progressButtonWasTapped:(UIGestureRecognizer *)gestureRecognizer
[self.delegate progressButtonDidCancelProgress:self];
}

if (self.progressCanceled) {
self.progressCanceled(self);
if (self.progressDidCancelBlock) {
self.progressDidCancelBlock(self);
}
} else if (self.state == JNJProgressButtonStateFinished) {
if ([self.delegate respondsToSelector:@selector(progressButtonEndButtonTapped:)]) {
[self.delegate progressButtonEndButtonTapped:self];
}

if (self.endButtonWasTapped) {
self.endButtonWasTapped(self);
if (self.endButtonDidTapBlock) {
self.endButtonDidTapBlock(self);
}
}
}
Expand Down

0 comments on commit 22be3a2

Please sign in to comment.