Skip to content

Commit

Permalink
1.2.1
Browse files Browse the repository at this point in the history
• Added new color options to the determinate progress indicators
• Added a new detailTextLabel
• Increased textLabel font size
• Updated examples
  • Loading branch information
JonasGessner committed Aug 29, 2014
1 parent 2fac179 commit c7013f8
Show file tree
Hide file tree
Showing 12 changed files with 201 additions and 95 deletions.
4 changes: 2 additions & 2 deletions JGProgressHUD Tests/JGProgressHUD Tests/JGAppDelegate.m
Expand Up @@ -26,7 +26,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Expand All @@ -35,7 +35,7 @@ - (void)applicationWillResignActive:(UIApplication *)application

- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

Expand Down
108 changes: 55 additions & 53 deletions JGProgressHUD Tests/JGProgressHUD Tests/JGViewController.m
Expand Up @@ -79,7 +79,7 @@ - (JGProgressHUD *)prototypeHUD {
return HUD;
}

- (void)success {
- (void)showSuccessHUD {
JGProgressHUD *HUD = self.prototypeHUD;

HUD.textLabel.text = @"Success!";
Expand All @@ -92,7 +92,7 @@ - (void)success {
[HUD dismissAfterDelay:3.0];
}

- (void)error {
- (void)showErrorHUD {
JGProgressHUD *HUD = self.prototypeHUD;

HUD.textLabel.text = @"Error!";
Expand All @@ -105,15 +105,15 @@ - (void)error {
[HUD dismissAfterDelay:3.0];
}

- (void)simple {
- (void)showSimpleHUD {
JGProgressHUD *HUD = self.prototypeHUD;

[HUD showInView:self.navigationController.view];

[HUD dismissAfterDelay:3.0];
}

- (void)tapToCancel {
- (void)showCancellableHUD {
JGProgressHUD *HUD = self.prototypeHUD;

HUD.textLabel.text = @"Loading very long...";
Expand Down Expand Up @@ -173,7 +173,7 @@ - (void)tapToCancel {
[HUD dismissAfterDelay:120.0];
}

- (void)withText {
- (void)showNormalHUD {
JGProgressHUD *HUD = self.prototypeHUD;

HUD.textLabel.text = @"Loading...";
Expand All @@ -192,68 +192,70 @@ - (void)withText {

HUD.marginInsets = UIEdgeInsetsMake(0.0f, 0.0f, 10.0f, 0.0f);

[HUD dismissAfterDelay:3];
[HUD dismissAfterDelay:3.0];
}

- (void)progress {
- (void)showPieHUD {
JGProgressHUD *HUD = self.prototypeHUD;

HUD.indicatorView = [[JGProgressHUDPieIndicatorView alloc] initWithHUDStyle:HUD.style];

HUD.textLabel.text = @"Uploading...";
[HUD showInView:self.navigationController.view];
HUD.detailTextLabel.text = @"0% Complete";

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[HUD setProgress:0.25 animated:YES];
});
HUD.textLabel.text = @"Downloading...";
[HUD showInView:self.navigationController.view];

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[HUD setProgress:0.5 animated:YES];
});
HUD.layoutChangeAnimationDuration = 0.0;

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[HUD setProgress:0.75 animated:YES];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self incrementHUD:HUD progress:0];
});
}

- (void)incrementHUD:(JGProgressHUD *)HUD progress:(int)progress {
progress += 1;

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[HUD setProgress:1.0 animated:YES];
});
[HUD setProgress:progress/100.0f animated:NO];
HUD.detailTextLabel.text = [NSString stringWithFormat:@"%i%% Complete", progress];

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[HUD dismiss];
});
if (progress == 100) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
HUD.textLabel.text = @"Success";
HUD.detailTextLabel.text = nil;

HUD.layoutChangeAnimationDuration = 0.3;
HUD.indicatorView = [[JGProgressHUDSuccessIndicatorView alloc] init];
});

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[HUD dismiss];
});
}
else {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self incrementHUD:HUD progress:progress];
});
}
}

- (void)zoomAnimationWithRing {
- (void)showRingHUD {
JGProgressHUD *HUD = self.prototypeHUD;

HUD.indicatorView = [[JGProgressHUDRingIndicatorView alloc] initWithHUDStyle:HUD.style];

HUD.detailTextLabel.text = @"0% Complete";

HUD.textLabel.text = @"Downloading...";
[HUD showInView:self.navigationController.view];

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[HUD setProgress:0.25 animated:YES];
});

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[HUD setProgress:0.5 animated:YES];
});

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[HUD setProgress:0.75 animated:YES];
});

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[HUD setProgress:1.0 animated:YES];
});
HUD.layoutChangeAnimationDuration = 0.0;

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[HUD dismiss];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self incrementHUD:HUD progress:0];
});
}

- (void)textOnly {
- (void)showTextHUD {
JGProgressHUD *HUD = self.prototypeHUD;

HUD.indicatorView = nil;
Expand All @@ -269,7 +271,7 @@ - (void)textOnly {

[HUD showInView:self.navigationController.view];

[HUD dismissAfterDelay:2.0f];
[HUD dismissAfterDelay:2.0];
}

- (void)setHUDStyle:(UISegmentedControl *)c {
Expand Down Expand Up @@ -411,10 +413,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
cell.textLabel.text = @"Activity Indicator & Text, Transform";
break;
case 2:
cell.textLabel.text = @"Pie Progress";
cell.textLabel.text = @"Pie Progress, Text & Detail Text";
break;
case 3:
cell.textLabel.text = @"Ring Progress";
cell.textLabel.text = @"Ring Progress, Text & Detail Text";
break;
case 4:
cell.textLabel.text = @"Text Only, Bottom Position";
Expand Down Expand Up @@ -444,28 +446,28 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath

switch (indexPath.row) {
case 0:
[self simple];
[self showSimpleHUD];
break;
case 1:
[self withText];
[self showNormalHUD];
break;
case 2:
[self progress];
[self showPieHUD];
break;
case 3:
[self zoomAnimationWithRing];
[self showRingHUD];
break;
case 4:
[self textOnly];
[self showTextHUD];
break;
case 5:
[self success];
[self showSuccessHUD];
break;
case 6:
[self error];
[self showErrorHUD];
break;
case 7:
[self tapToCancel];
[self showCancellableHUD];
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions JGProgressHUD.podspec
@@ -1,14 +1,14 @@
Pod::Spec.new do |s|

s.name = "JGProgressHUD"
s.version = "1.2"
s.version = "1.2.1"
s.summary = "Powerful and modern progress HUD for iOS."
s.homepage = "https://github.com/JonasGessner/JGProgressHUD"
s.license = { :type => "MIT", :file => "LICENSE.txt" }
s.author = "Jonas Gessner"
s.social_media_url = "http://twitter.com/JonasGessner"
s.platform = :ios, "5.0"
s.source = { :git => "https://github.com/JonasGessner/JGProgressHUD.git", :tag => "v1.2" }
s.source = { :git => "https://github.com/JonasGessner/JGProgressHUD.git", :tag => "v1.2.1" }
s.source_files = "JGProgressHUD/JGProgressHUD/*.{h,m}"
s.resources = "JGProgressHUD/JGProgressHUD/JGProgressHUD Resources.bundle"
s.frameworks = "Foundation", "UIKit", "QuartzCore"
Expand Down
5 changes: 5 additions & 0 deletions JGProgressHUD/JGProgressHUD.xcodeproj/project.pbxproj
Expand Up @@ -333,6 +333,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = "";
WRAPPER_EXTENSION = bundle;
};
name = Debug;
Expand All @@ -349,6 +350,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = "";
WRAPPER_EXTENSION = bundle;
};
name = Release;
Expand Down Expand Up @@ -430,6 +432,7 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
WARNING_CFLAGS = "-Wfloat-equal";
};
name = Debug;
};
Expand All @@ -442,6 +445,7 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
WARNING_CFLAGS = "-Wfloat-equal";
};
name = Release;
};
Expand All @@ -455,6 +459,7 @@
6B60B24619A3B3C500ED1A4E /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
6BC0186E197B2AA500DA4C49 /* Build configuration list for PBXProject "JGProgressHUD" */ = {
isa = XCConfigurationList;
Expand Down
14 changes: 13 additions & 1 deletion JGProgressHUD/JGProgressHUD/JGProgressHUD.h
Expand Up @@ -45,7 +45,6 @@ typedef NS_ENUM(NSUInteger, JGProgressHUDInteractionType) {
JGProgressHUDInteractionTypeBlockNoTouches
};


@class JGProgressHUD;

@protocol JGProgressHUDDelegate <NSObject>
Expand Down Expand Up @@ -137,6 +136,11 @@ typedef NS_ENUM(NSUInteger, JGProgressHUDInteractionType) {
*/
@property (nonatomic, strong, readonly) UILabel *textLabel;

/**
The label used to present detail text on the HUD. set the @c text property of this label to change the displayed text. You may not change the label's @c frame or @c bounds.
*/
@property (nonatomic, strong, readonly) UILabel *detailTextLabel;

/**
The indicator view. You can assign a custom subclass of JGProgressHUDIndicatorView to this property or one of the default indicator views (if you do so, you should assign it before showing the HUD).
Expand Down Expand Up @@ -335,3 +339,11 @@ typedef NS_ENUM(NSUInteger, JGProgressHUDInteractionType) {
@property (nonatomic, assign) BOOL useProgressIndicatorView DEPRECATED_ATTRIBUTE;

@end


/**
Macro for safe floating point comparison (for internal use in JGProgressHUD).
*/
#ifndef fequal
#define fequal(a,b) (fabs((a) - (b)) < FLT_EPSILON)
#endif

0 comments on commit c7013f8

Please sign in to comment.