Skip to content

Commit

Permalink
Action queue fixes + readme + example
Browse files Browse the repository at this point in the history
  • Loading branch information
zacaltman committed Dec 19, 2012
1 parent 97659ca commit 2abc115
Show file tree
Hide file tree
Showing 8 changed files with 283 additions and 163 deletions.
Binary file not shown.
Expand Up @@ -2,19 +2,4 @@
<Bucket
type = "1"
version = "1.0">
<FileBreakpoints>
<FileBreakpoint
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../ZAActivityBar.m"
timestampString = "377567662.645537"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "100"
endingLineNumber = "100"
landmarkName = "-showWithStatus:"
landmarkType = "5">
</FileBreakpoint>
</FileBreakpoints>
</Bucket>
Expand Up @@ -10,12 +10,17 @@

@interface ViewController : UIViewController <UITextFieldDelegate> {
__weak IBOutlet UITextField *_textbox;

__weak IBOutlet UILabel *_actionLabel1;
__weak IBOutlet UILabel *_actionLabel2;
__weak IBOutlet UILabel *_actionLabel3;
}

// Action Methods
- (IBAction) show:(id)sender;
- (IBAction) showSuccess:(id)sender;
- (IBAction) showError:(id)sender;
- (IBAction) dismiss:(id)sender;
- (IBAction) dismissAll:(id)sender;

@end
38 changes: 33 additions & 5 deletions Example/ZAActivityBarSample/ZAActivityBarSample/ViewController.m
Expand Up @@ -16,36 +16,64 @@ @implementation ViewController
#pragma mark -
#pragma mark Action Methods

- (NSString *) actionForSender:(id)sender {
- (NSString *) actionForSender:(id)sender show:(BOOL)show {

// Get the action
UIButton *button = (UIButton *)sender;
NSString *action = [NSString stringWithFormat:@"Action%i",button.tag];

// Set the title
UILabel *label = nil;
if (button.tag == 1) label = _actionLabel1;
if (button.tag == 2) label = _actionLabel2;
if (button.tag == 3) label = _actionLabel3;

NSString *buttonText = nil;
if (show) {
buttonText = [NSString stringWithFormat:@"%@: %@", action, _textbox.text];
} else {
buttonText = [NSString stringWithFormat:@"%@: -- dismissed --", action];
}

[label setText:buttonText];

return action;
}

- (IBAction) show:(id)sender {
[self dismissTextField];
NSString *action = [self actionForSender:sender];
NSString *action = [self actionForSender:sender show:YES];
[ZAActivityBar showWithStatus:_textbox.text forAction:action];
}

- (IBAction) showSuccess:(id)sender {
[self dismissTextField];
NSString *action = [self actionForSender:sender];
NSString *action = [self actionForSender:sender show:NO];
[ZAActivityBar showSuccessWithStatus:_textbox.text forAction:action];
}

- (IBAction) showError:(id)sender {
[self dismissTextField];
NSString *action = [self actionForSender:sender];
NSString *action = [self actionForSender:sender show:NO];
[ZAActivityBar showErrorWithStatus:_textbox.text forAction:action];
}

- (IBAction) dismiss:(id)sender {
[self dismissTextField];
NSString *action = [self actionForSender:sender];
NSString *action = [self actionForSender:sender show:NO];
[ZAActivityBar dismissForAction:action];
}

- (IBAction) dismissAll:(id)sender {
[self dismissTextField];

[_actionLabel1 setText:@"Action1: -- dismissed --"];
[_actionLabel2 setText:@"Action2: -- dismissed --"];
[_actionLabel3 setText:@"Action3: -- dismissed --"];

[ZAActivityBar dismiss];
}

///////////////////////////////////////////////////////////////

#pragma mark -
Expand Down

0 comments on commit 2abc115

Please sign in to comment.