Skip to content

Commit

Permalink
Fix merge conflict.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdg committed Sep 29, 2010
2 parents 1d4cd3d + 766b92a commit a40421c
Show file tree
Hide file tree
Showing 17 changed files with 1,453 additions and 330 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,6 +4,7 @@ build/
*.mode1v3
*.mode2v3
*.perspectivev3
xcuserdata/

# old skool
.svn
Expand Down
4 changes: 2 additions & 2 deletions Demo/Classes/HudDemoAppDelegate.h
Expand Up @@ -12,11 +12,11 @@

@interface HudDemoAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
HudDemoViewController *viewController;
UINavigationController *navController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet HudDemoViewController *viewController;
@property (nonatomic, retain) IBOutlet UINavigationController *navController;

@end

6 changes: 3 additions & 3 deletions Demo/Classes/HudDemoAppDelegate.m
Expand Up @@ -12,19 +12,19 @@
@implementation HudDemoAppDelegate

@synthesize window;
@synthesize viewController;
@synthesize navController;


- (void)applicationDidFinishLaunching:(UIApplication *)application {

// Override point for customization after app launch
[window addSubview:viewController.view];
[window addSubview:navController.view];
[window makeKeyAndVisible];
}


- (void)dealloc {
[viewController release];
[navController release];
[window release];
[super dealloc];
}
Expand Down
3 changes: 3 additions & 0 deletions Demo/Classes/HudDemoViewController.h
Expand Up @@ -17,7 +17,10 @@
- (IBAction)showWithLabel:(id)sender;
- (IBAction)showWithDetailsLabel:(id)sender;
- (IBAction)showWithLabelDeterminate:(id)sender;
- (IBAction)showWithCustomView:(id)sender;
- (IBAction)showWithLabelMixed:(id)sender;
- (IBAction)showUsingBlocks:(id)sender;
- (IBAction)showOnWindow:(id)sender;

- (void)myTask;
- (void)myProgressTask;
Expand Down
108 changes: 93 additions & 15 deletions Demo/Classes/HudDemoViewController.m
Expand Up @@ -7,12 +7,18 @@
//

#import "HudDemoViewController.h"
#import <unistd.h>

@implementation HudDemoViewController

#pragma mark -
#pragma mark Lifecycle methods

- (void)viewDidLoad {
UIView *content = [[self.view subviews] objectAtIndex:0];
((UIScrollView *)self.view).contentSize = content.bounds.size;
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
Expand All @@ -25,6 +31,11 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
return YES;
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
UIView *content = [[self.view subviews] objectAtIndex:0];
((UIScrollView *)self.view).contentSize = content.bounds.size;
}

- (void)dealloc {
[super dealloc];
}
Expand All @@ -33,14 +44,14 @@ - (void)dealloc {
#pragma mark IBActions

- (IBAction)showSimple:(id)sender {
// The hud will dispable all input on the view
HUD = [[MBProgressHUD alloc] initWithView:self.view];
// The hud will dispable all input on the view (use the higest view possible in the view hierarchy)
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];

//HUD.graceTime = 0.5;
//HUD.minShowTime = 5.0;

// Add HUD to screen
[self.view addSubview:HUD];
[self.navigationController.view addSubview:HUD];

// Regisete for HUD callbacks so we can remove it from the window at the right time
HUD.delegate = self;
Expand All @@ -50,11 +61,11 @@ - (IBAction)showSimple:(id)sender {
}

- (IBAction)showWithLabel:(id)sender {
// The hud will dispable all input on the view
HUD = [[MBProgressHUD alloc] initWithView:self.view];
// The hud will dispable all input on the view (use the higest view possible in the view hierarchy)
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];

// Add HUD to screen
[self.view addSubview:HUD];
[self.navigationController.view addSubview:HUD];

// Regisete for HUD callbacks so we can remove it from the window at the right time
HUD.delegate = self;
Expand All @@ -66,11 +77,11 @@ - (IBAction)showWithLabel:(id)sender {
}

- (IBAction)showWithDetailsLabel:(id)sender {
// The hud will dispable all input on the view
HUD = [[MBProgressHUD alloc] initWithView:self.view];
// The hud will dispable all input on the view (use the higest view possible in the view hierarchy)
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];

// Add HUD to screen
[self.view addSubview:HUD];
[self.navigationController.view addSubview:HUD];

// Regisete for HUD callbacks so we can remove it from the window at the right time
HUD.delegate = self;
Expand All @@ -83,14 +94,14 @@ - (IBAction)showWithDetailsLabel:(id)sender {
}

- (IBAction)showWithLabelDeterminate:(id)sender {
// The hud will dispable all input on the view
HUD = [[MBProgressHUD alloc] initWithView:self.view];
// The hud will dispable all input on the view (use the higest view possible in the view hierarchy)
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];

// Set determinate mode
HUD.mode = MBProgressHUDModeDeterminate;

// Add HUD to screen
[self.view addSubview:HUD];
[self.navigationController.view addSubview:HUD];

// Regisete for HUD callbacks so we can remove it from the window at the right time
HUD.delegate = self;
Expand All @@ -101,12 +112,38 @@ - (IBAction)showWithLabelDeterminate:(id)sender {
[HUD showWhileExecuting:@selector(myProgressTask) onTarget:self withObject:nil animated:YES];
}

- (IBAction)showWithCustomView:(id)sender {
// The hud will dispable all input on the view (use the higest view possible in the view hierarchy)
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];

// The sample image is based on the work by www.pixelpressicons.com, http://creativecommons.org/licenses/by/2.5/ca/
// Make the customViews 37 by 37 pixels for best results (those are the bounds of the build-in progress indicators)
HUD.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark.png"]] autorelease];

// Set custom view mode
HUD.mode = MBProgressHUDModeCustomView;

// Add HUD to screen
[self.navigationController.view addSubview:HUD];

// Regisete for HUD callbacks so we can remove it from the window at the right time
HUD.delegate = self;

HUD.labelText = @"Completed";

// This would only show the completed text with no visible custom view
// HUD.customView = [[UIView alloc] initWithFrame:CGRectZero];

// Show the HUD while the provided method executes in a new thread
[HUD showWhileExecuting:@selector(myProgressTask) onTarget:self withObject:nil animated:YES];
}

- (IBAction)showWithLabelMixed:(id)sender {
// The hud will dispable all input on the view
HUD = [[MBProgressHUD alloc] initWithView:self.view];
// The hud will dispable all input on the view (use the higest view possible in the view hierarchy)
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];

// Add HUD to screen
[self.view addSubview:HUD];
[self.navigationController.view addSubview:HUD];

// Regisete for HUD callbacks so we can remove it from the window at the right time
HUD.delegate = self;
Expand All @@ -117,6 +154,41 @@ - (IBAction)showWithLabelMixed:(id)sender {
[HUD showWhileExecuting:@selector(myMixedTask) onTarget:self withObject:nil animated:YES];
}

- (IBAction)showUsingBlocks:(id)sender {
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
// Show the HUD in the main tread
dispatch_async(dispatch_get_main_queue(), ^{
// No need to hod onto (retain)
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
hud.labelText = @"Loading";
});

// Do a taks in the background
[self myTask];

// Hide the HUD in the main tread
dispatch_async(dispatch_get_main_queue(), ^{
[MBProgressHUD hideHUDForView:self.navigationController.view animated:YES];
});
});
}

- (IBAction)showOnWindow:(id)sender {
// The hud will dispable all input on the view
HUD = [[MBProgressHUD alloc] initWithView:self.view.window];

// Add HUD to screen
[self.view.window addSubview:HUD];

// Regisete for HUD callbacks so we can remove it from the window at the right time
HUD.delegate = self;

HUD.labelText = @"Loading";

// Show the HUD while the provided method executes in a new thread
[HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];
}

#pragma mark -
#pragma mark Execution code

Expand Down Expand Up @@ -155,6 +227,12 @@ - (void)myMixedTask {
HUD.mode = MBProgressHUDModeIndeterminate;
HUD.labelText = @"Cleaning up";
sleep(2);
// The sample image is based on the work by www.pixelpressicons.com, http://creativecommons.org/licenses/by/2.5/ca/
// Make the customViews 37 by 37 pixels for best results (those are the bounds of the build-in progress indicators)
HUD.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark.png"]] autorelease];
HUD.mode = MBProgressHUDModeCustomView;
HUD.labelText = @"Completed";
sleep(2);
}

#pragma mark -
Expand Down
Binary file added Demo/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 39 additions & 5 deletions Demo/HudDemo.xcodeproj/project.pbxproj
Expand Up @@ -16,6 +16,10 @@
28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
28D7ACF80DDB3853001CB0EB /* HudDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* HudDemoViewController.m */; };
D22F7D810F85241C00550BB3 /* MBProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = D22F7D800F85241C00550BB3 /* MBProgressHUD.m */; };
D277FDB311FC834200304321 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = D277FDB211FC834200304321 /* Default.png */; };
D277FDB911FC877E00304321 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = D277FDB711FC877E00304321 /* Icon.png */; };
D277FDBA11FC877E00304321 /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D277FDB811FC877E00304321 /* Icon@2x.png */; };
D2F88CD6115E9F7F00E6DB82 /* 37x-Checkmark.png in Resources */ = {isa = PBXBuildFile; fileRef = D2F88CD5115E9F7F00E6DB82 /* 37x-Checkmark.png */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -28,12 +32,16 @@
2899E5210DE3E06400AC0155 /* HudDemoViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HudDemoViewController.xib; sourceTree = "<group>"; };
28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
28D7ACF60DDB3853001CB0EB /* HudDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HudDemoViewController.h; sourceTree = "<group>"; };
28D7ACF70DDB3853001CB0EB /* HudDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HudDemoViewController.m; sourceTree = "<group>"; };
28D7ACF70DDB3853001CB0EB /* HudDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HudDemoViewController.m; sourceTree = "<group>"; usesTabs = 1; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
32CA4F630368D1EE00C91783 /* HudDemo_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HudDemo_Prefix.pch; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D22F7D7F0F85241C00550BB3 /* MBProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MBProgressHUD.h; path = ../MBProgressHUD.h; sourceTree = SOURCE_ROOT; };
D22F7D800F85241C00550BB3 /* MBProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MBProgressHUD.m; path = ../../MBProgressHUD.m; sourceTree = "<group>"; };
D277FDB211FC834200304321 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
D277FDB711FC877E00304321 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
D277FDB811FC877E00304321 /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x.png"; sourceTree = "<group>"; };
D2F88CD5115E9F7F00E6DB82 /* 37x-Checkmark.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "37x-Checkmark.png"; path = "Images/37x-Checkmark.png"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -95,8 +103,8 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
2899E5210DE3E06400AC0155 /* HudDemoViewController.xib */,
28AD733E0D9D9553002E5188 /* MainWindow.xib */,
D277FDBF11FC880100304321 /* UI */,
D277FDBD11FC879500304321 /* Images */,
8D1107310486CEB800E47090 /* Info.plist */,
);
name = Resources;
Expand All @@ -112,6 +120,26 @@
name = Frameworks;
sourceTree = "<group>";
};
D277FDBD11FC879500304321 /* Images */ = {
isa = PBXGroup;
children = (
D277FDB711FC877E00304321 /* Icon.png */,
D277FDB811FC877E00304321 /* Icon@2x.png */,
D277FDB211FC834200304321 /* Default.png */,
D2F88CD5115E9F7F00E6DB82 /* 37x-Checkmark.png */,
);
name = Images;
sourceTree = "<group>";
};
D277FDBF11FC880100304321 /* UI */ = {
isa = PBXGroup;
children = (
2899E5210DE3E06400AC0155 /* HudDemoViewController.xib */,
28AD733E0D9D9553002E5188 /* MainWindow.xib */,
);
name = UI;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -156,6 +184,10 @@
files = (
28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */,
2899E5220DE3E06400AC0155 /* HudDemoViewController.xib in Resources */,
D2F88CD6115E9F7F00E6DB82 /* 37x-Checkmark.png in Resources */,
D277FDB311FC834200304321 /* Default.png in Resources */,
D277FDB911FC877E00304321 /* Icon.png in Resources */,
D277FDBA11FC877E00304321 /* Icon@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -208,11 +240,12 @@
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = iphoneos2.2;
SDKROOT = iphoneos4.0;
};
name = Debug;
};
Expand All @@ -222,10 +255,11 @@
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = iphoneos2.2;
SDKROOT = iphoneos4.0;
};
name = Release;
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a40421c

Please sign in to comment.