Skip to content

Commit a40421c

Browse files
committed
Fix merge conflict.
2 parents 1d4cd3d + 766b92a commit a40421c

17 files changed

+1453
-330
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ build/
44
*.mode1v3
55
*.mode2v3
66
*.perspectivev3
7+
xcuserdata/
78

89
# old skool
910
.svn

Demo/Classes/HudDemoAppDelegate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
@interface HudDemoAppDelegate : NSObject <UIApplicationDelegate> {
1414
UIWindow *window;
15-
HudDemoViewController *viewController;
15+
UINavigationController *navController;
1616
}
1717

1818
@property (nonatomic, retain) IBOutlet UIWindow *window;
19-
@property (nonatomic, retain) IBOutlet HudDemoViewController *viewController;
19+
@property (nonatomic, retain) IBOutlet UINavigationController *navController;
2020

2121
@end
2222

Demo/Classes/HudDemoAppDelegate.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
@implementation HudDemoAppDelegate
1313

1414
@synthesize window;
15-
@synthesize viewController;
15+
@synthesize navController;
1616

1717

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

2020
// Override point for customization after app launch
21-
[window addSubview:viewController.view];
21+
[window addSubview:navController.view];
2222
[window makeKeyAndVisible];
2323
}
2424

2525

2626
- (void)dealloc {
27-
[viewController release];
27+
[navController release];
2828
[window release];
2929
[super dealloc];
3030
}

Demo/Classes/HudDemoViewController.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
- (IBAction)showWithLabel:(id)sender;
1818
- (IBAction)showWithDetailsLabel:(id)sender;
1919
- (IBAction)showWithLabelDeterminate:(id)sender;
20+
- (IBAction)showWithCustomView:(id)sender;
2021
- (IBAction)showWithLabelMixed:(id)sender;
22+
- (IBAction)showUsingBlocks:(id)sender;
23+
- (IBAction)showOnWindow:(id)sender;
2124

2225
- (void)myTask;
2326
- (void)myProgressTask;

Demo/Classes/HudDemoViewController.m

Lines changed: 93 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@
77
//
88

99
#import "HudDemoViewController.h"
10+
#import <unistd.h>
1011

1112
@implementation HudDemoViewController
1213

1314
#pragma mark -
1415
#pragma mark Lifecycle methods
1516

17+
- (void)viewDidLoad {
18+
UIView *content = [[self.view subviews] objectAtIndex:0];
19+
((UIScrollView *)self.view).contentSize = content.bounds.size;
20+
}
21+
1622
- (void)didReceiveMemoryWarning {
1723
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
1824
// Release anything that's not essential, such as cached data
@@ -25,6 +31,11 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
2531
return YES;
2632
}
2733

34+
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
35+
UIView *content = [[self.view subviews] objectAtIndex:0];
36+
((UIScrollView *)self.view).contentSize = content.bounds.size;
37+
}
38+
2839
- (void)dealloc {
2940
[super dealloc];
3041
}
@@ -33,14 +44,14 @@ - (void)dealloc {
3344
#pragma mark IBActions
3445

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

3950
//HUD.graceTime = 0.5;
4051
//HUD.minShowTime = 5.0;
4152

4253
// Add HUD to screen
43-
[self.view addSubview:HUD];
54+
[self.navigationController.view addSubview:HUD];
4455

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

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

5667
// Add HUD to screen
57-
[self.view addSubview:HUD];
68+
[self.navigationController.view addSubview:HUD];
5869

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

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

7283
// Add HUD to screen
73-
[self.view addSubview:HUD];
84+
[self.navigationController.view addSubview:HUD];
7485

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

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

89100
// Set determinate mode
90101
HUD.mode = MBProgressHUDModeDeterminate;
91102

92103
// Add HUD to screen
93-
[self.view addSubview:HUD];
104+
[self.navigationController.view addSubview:HUD];
94105

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

115+
- (IBAction)showWithCustomView:(id)sender {
116+
// The hud will dispable all input on the view (use the higest view possible in the view hierarchy)
117+
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
118+
119+
// The sample image is based on the work by www.pixelpressicons.com, http://creativecommons.org/licenses/by/2.5/ca/
120+
// Make the customViews 37 by 37 pixels for best results (those are the bounds of the build-in progress indicators)
121+
HUD.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark.png"]] autorelease];
122+
123+
// Set custom view mode
124+
HUD.mode = MBProgressHUDModeCustomView;
125+
126+
// Add HUD to screen
127+
[self.navigationController.view addSubview:HUD];
128+
129+
// Regisete for HUD callbacks so we can remove it from the window at the right time
130+
HUD.delegate = self;
131+
132+
HUD.labelText = @"Completed";
133+
134+
// This would only show the completed text with no visible custom view
135+
// HUD.customView = [[UIView alloc] initWithFrame:CGRectZero];
136+
137+
// Show the HUD while the provided method executes in a new thread
138+
[HUD showWhileExecuting:@selector(myProgressTask) onTarget:self withObject:nil animated:YES];
139+
}
140+
104141
- (IBAction)showWithLabelMixed:(id)sender {
105-
// The hud will dispable all input on the view
106-
HUD = [[MBProgressHUD alloc] initWithView:self.view];
142+
// The hud will dispable all input on the view (use the higest view possible in the view hierarchy)
143+
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
107144

108145
// Add HUD to screen
109-
[self.view addSubview:HUD];
146+
[self.navigationController.view addSubview:HUD];
110147

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

157+
- (IBAction)showUsingBlocks:(id)sender {
158+
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
159+
// Show the HUD in the main tread
160+
dispatch_async(dispatch_get_main_queue(), ^{
161+
// No need to hod onto (retain)
162+
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
163+
hud.labelText = @"Loading";
164+
});
165+
166+
// Do a taks in the background
167+
[self myTask];
168+
169+
// Hide the HUD in the main tread
170+
dispatch_async(dispatch_get_main_queue(), ^{
171+
[MBProgressHUD hideHUDForView:self.navigationController.view animated:YES];
172+
});
173+
});
174+
}
175+
176+
- (IBAction)showOnWindow:(id)sender {
177+
// The hud will dispable all input on the view
178+
HUD = [[MBProgressHUD alloc] initWithView:self.view.window];
179+
180+
// Add HUD to screen
181+
[self.view.window addSubview:HUD];
182+
183+
// Regisete for HUD callbacks so we can remove it from the window at the right time
184+
HUD.delegate = self;
185+
186+
HUD.labelText = @"Loading";
187+
188+
// Show the HUD while the provided method executes in a new thread
189+
[HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];
190+
}
191+
120192
#pragma mark -
121193
#pragma mark Execution code
122194

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

160238
#pragma mark -

Demo/Default.png

6.06 KB
Loading

Demo/HudDemo.xcodeproj/project.pbxproj

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
1717
28D7ACF80DDB3853001CB0EB /* HudDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* HudDemoViewController.m */; };
1818
D22F7D810F85241C00550BB3 /* MBProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = D22F7D800F85241C00550BB3 /* MBProgressHUD.m */; };
19+
D277FDB311FC834200304321 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = D277FDB211FC834200304321 /* Default.png */; };
20+
D277FDB911FC877E00304321 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = D277FDB711FC877E00304321 /* Icon.png */; };
21+
D277FDBA11FC877E00304321 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D277FDB811FC877E00304321 /* [email protected] */; };
22+
D2F88CD6115E9F7F00E6DB82 /* 37x-Checkmark.png in Resources */ = {isa = PBXBuildFile; fileRef = D2F88CD5115E9F7F00E6DB82 /* 37x-Checkmark.png */; };
1923
/* End PBXBuildFile section */
2024

2125
/* Begin PBXFileReference section */
@@ -28,12 +32,16 @@
2832
2899E5210DE3E06400AC0155 /* HudDemoViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HudDemoViewController.xib; sourceTree = "<group>"; };
2933
28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
3034
28D7ACF60DDB3853001CB0EB /* HudDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HudDemoViewController.h; sourceTree = "<group>"; };
31-
28D7ACF70DDB3853001CB0EB /* HudDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HudDemoViewController.m; sourceTree = "<group>"; };
35+
28D7ACF70DDB3853001CB0EB /* HudDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HudDemoViewController.m; sourceTree = "<group>"; usesTabs = 1; };
3236
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
3337
32CA4F630368D1EE00C91783 /* HudDemo_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HudDemo_Prefix.pch; sourceTree = "<group>"; };
3438
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3539
D22F7D7F0F85241C00550BB3 /* MBProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MBProgressHUD.h; path = ../MBProgressHUD.h; sourceTree = SOURCE_ROOT; };
3640
D22F7D800F85241C00550BB3 /* MBProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MBProgressHUD.m; path = ../../MBProgressHUD.m; sourceTree = "<group>"; };
41+
D277FDB211FC834200304321 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
42+
D277FDB711FC877E00304321 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
43+
D277FDB811FC877E00304321 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
44+
D2F88CD5115E9F7F00E6DB82 /* 37x-Checkmark.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "37x-Checkmark.png"; path = "Images/37x-Checkmark.png"; sourceTree = "<group>"; };
3745
/* End PBXFileReference section */
3846

3947
/* Begin PBXFrameworksBuildPhase section */
@@ -95,8 +103,8 @@
95103
29B97317FDCFA39411CA2CEA /* Resources */ = {
96104
isa = PBXGroup;
97105
children = (
98-
2899E5210DE3E06400AC0155 /* HudDemoViewController.xib */,
99-
28AD733E0D9D9553002E5188 /* MainWindow.xib */,
106+
D277FDBF11FC880100304321 /* UI */,
107+
D277FDBD11FC879500304321 /* Images */,
100108
8D1107310486CEB800E47090 /* Info.plist */,
101109
);
102110
name = Resources;
@@ -112,6 +120,26 @@
112120
name = Frameworks;
113121
sourceTree = "<group>";
114122
};
123+
D277FDBD11FC879500304321 /* Images */ = {
124+
isa = PBXGroup;
125+
children = (
126+
D277FDB711FC877E00304321 /* Icon.png */,
127+
D277FDB811FC877E00304321 /* [email protected] */,
128+
D277FDB211FC834200304321 /* Default.png */,
129+
D2F88CD5115E9F7F00E6DB82 /* 37x-Checkmark.png */,
130+
);
131+
name = Images;
132+
sourceTree = "<group>";
133+
};
134+
D277FDBF11FC880100304321 /* UI */ = {
135+
isa = PBXGroup;
136+
children = (
137+
2899E5210DE3E06400AC0155 /* HudDemoViewController.xib */,
138+
28AD733E0D9D9553002E5188 /* MainWindow.xib */,
139+
);
140+
name = UI;
141+
sourceTree = "<group>";
142+
};
115143
/* End PBXGroup section */
116144

117145
/* Begin PBXNativeTarget section */
@@ -156,6 +184,10 @@
156184
files = (
157185
28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */,
158186
2899E5220DE3E06400AC0155 /* HudDemoViewController.xib in Resources */,
187+
D2F88CD6115E9F7F00E6DB82 /* 37x-Checkmark.png in Resources */,
188+
D277FDB311FC834200304321 /* Default.png in Resources */,
189+
D277FDB911FC877E00304321 /* Icon.png in Resources */,
190+
D277FDBA11FC877E00304321 /* [email protected] in Resources */,
159191
);
160192
runOnlyForDeploymentPostprocessing = 0;
161193
};
@@ -208,11 +240,12 @@
208240
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
209241
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
210242
GCC_C_LANGUAGE_STANDARD = c99;
243+
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
211244
GCC_WARN_ABOUT_RETURN_TYPE = YES;
212245
GCC_WARN_UNUSED_VARIABLE = YES;
213246
ONLY_ACTIVE_ARCH = YES;
214247
PREBINDING = NO;
215-
SDKROOT = iphoneos2.2;
248+
SDKROOT = iphoneos4.0;
216249
};
217250
name = Debug;
218251
};
@@ -222,10 +255,11 @@
222255
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
223256
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
224257
GCC_C_LANGUAGE_STANDARD = c99;
258+
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
225259
GCC_WARN_ABOUT_RETURN_TYPE = YES;
226260
GCC_WARN_UNUSED_VARIABLE = YES;
227261
PREBINDING = NO;
228-
SDKROOT = iphoneos2.2;
262+
SDKROOT = iphoneos4.0;
229263
};
230264
name = Release;
231265
};

Demo/HudDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)