52 Commits

Author SHA1 Message Date
Matej Bukovinski 49a531e7f7 Ignoring performSelector:withObject: warning. 2012-01-17 17:20:59 +01:00
Matej Bukovinski b65a713d61 Merge remote-tracking branch 'jdg/master' 2012-01-17 16:22:47 +01:00
Matej Bukovinski 08c16cdd5d Fixed the animated parameter in hide:afterDelay: method. 2012-01-17 16:16:16 +01:00
Matej Bukovinski 2235e68fc0 Project upgrade. 2012-01-17 16:10:28 +01:00
Matej Bukovinski caa804b7f5 Fixed a typo. 2012-01-17 16:09:09 +01:00
Jonathan George 1f34a8b83d Merge pull request #36 from renebigot/master
Bug correction in notification observer + ARC
2012-01-04 09:38:42 -08:00
renebigot bef5e79195 Version history modification 2012-01-03 22:56:35 +01:00
renebigot 537d279044 ARC compatibility + EXC_BAD_ACCESS correction
- Added support for ARC
- Still compatible with non ARC projects
- Notification observer for interface orientation moved to the
removeFromSuperview method. (it could cause an EXC_BAD_ACCESS otherwise)
- Remove one deviceOrientationDidChange: prototype definition
2012-01-03 22:54:16 +01:00
Matej Bukovinski f4e551a9c2 Merge pull request #29 from matej/master
Fixed two typos.
2011-11-14 01:11:19 -08:00
Matej Bukovinski 5d72491221 Fixed another typo. 2011-11-14 10:09:23 +01:00
Matej Bukovinski f5d0deb7f0 Fixed a typo. 2011-11-04 19:33:12 +01:00
Matej Bukovinski e324cbaeb2 Merge pull request #27 from matej/master
Various fixes
2011-11-03 08:17:28 -07:00
Matej Bukovinski 645a9dedbc Fixed background dimming rotation issues.
Closes #19
2011-11-03 16:06:41 +01:00
Matej Bukovinski 1fd1cd9692 Added the ability to force equal hud dimensions. 2011-11-03 15:53:42 +01:00
Matej Bukovinski fa1f7b7405 Minor margin adjustments. 2011-11-03 15:43:16 +01:00
Matej Bukovinski 66b75a2ebf Preventing details label screen overflow. 2011-11-03 15:24:28 +01:00
Matej Bukovinski c357ebbfdd Merge pull request #22 from tadelv/master
Add multiple lines support to detailsLabel
2011-11-03 07:05:14 -07:00
Vid Tadel 88d5881046 add multiple lines to detailsLabel 2011-10-03 21:42:43 -07:00
Matej Bukovinski 94d67d3464 Minimum bezel size property added. 2011-08-23 10:16:19 +02:00
Matej Bukovinski 3e3e361d55 Fixed static analyzer issues (leaks).
Closes #15.
2011-06-27 15:09:51 +02:00
Matej Bukovinski 0a516ff898 Some minor refactoring and cleanup. 2011-06-23 19:59:34 +02:00
Matej Bukovinski 304fde317c Merge pull request #17 from sbandol/master
Radial Gradient Option
2011-06-23 10:10:40 -07:00
StaS 54b1714471 Radial Gradient
Added option for a HUD with a radial gradient background.
2011-06-23 14:18:41 +02:00
Matej Bukovinski ca75dc3dfd Minor README and copyright updates. 2011-06-17 19:37:15 +02:00
Matej Bukovinski 9a0af8570b Merge 2011-06-17 19:27:25 +02:00
Jonathan George 019f4af26e Merge pull request #15 from meslater/master
iOS 5 support since UIProgressView no longer calls drawRect.
2011-06-15 12:36:48 -07:00
Michael Slater 97a4139b78 Removed dependency on UIProgressView in the round progress view to support iOS5 and replaced UIDeviceOrientation that was being cast from a UIInterfaceOrientation 2011-06-15 20:19:13 +01:00
Matej Bukovinski f1b998db91 Merge pull request #13 from insanehunter/master
Fixed compilation warnings
2011-06-03 01:38:36 -07:00
Sergei Cherepanov 110ec60b2e Fixed compilation warnings (double-float (64-32 bit) conversion and undeclared selectors) 2011-06-03 12:10:49 +04:00
Matej Bukovinski dc919da320 Fix for landscape problems when added to a window.
Closes #9.
2011-04-29 17:45:54 +02:00
Matej Bukovinski bba629af75 Added a NSURLConnection example. 2011-04-29 17:18:44 +02:00
Matej Bukovinski 62771b41d1 Added a new method (hid:afterDelay:). 2011-04-29 16:41:26 +02:00
Matej Bukovinski f6b9d49648 Demo project enhancements. 2011-04-29 16:24:09 +02:00
Matej Bukovinski c1cd3c88ed Removed an obsolete note. 2011-04-29 15:49:18 +02:00
Matej Bukovinski ad4c7aec08 Protocol and documentation cleanup. 2011-04-29 15:48:29 +02:00
Matej Bukovinski 1ea2644a29 Reimplemented MBRoundProgressView.
- no longer a UIProgressView subclass
2011-04-29 15:38:50 +02:00
Matej Bukovinski 0a305ebaea drawRect: cleanup 2011-04-29 15:25:02 +02:00
Matej Bukovinski 363bfd5aeb Sharper HUD border. 2011-04-29 15:21:27 +02:00
Matej Bukovinski bf5efa26e3 Fixed an incorrect variable type. 2011-02-03 09:46:58 +01:00
Jonathan George bba11aec5a Merge branch 'master' of https://github.com/myell0w/MBProgressHUD into myell0w-master 2010-12-03 02:16:42 -06:00
Daniel Yoo 7202c64683 Fix compiler warnings about undeclared selectors. 2010-12-02 09:21:55 -08:00
Matthias Tretter 66ff32a9ab Added HUD as parameter to delegate-call 2010-11-14 17:05:18 +01:00
Matej Bukovinski 6597ffb9e2 Updated the base SDK. 2010-11-08 09:29:35 +01:00
Matej Bukovinski f40a7a54a4 Checking if we still have a superView. Closes #7. 2010-11-08 09:28:47 +01:00
Matej Bukovinski 8faeea2300 Margin is now an exposed property. 2010-11-05 18:14:36 +01:00
Matej Bukovinski 4aba246bfa Changed the init syntax. Closes #8. 2010-11-04 00:17:05 +01:00
Frederic Jean b1aeb8602c Fixed a compiler warning. 2010-10-19 10:33:49 -06:00
Jonathan George a40421c705 Fix merge conflict. 2010-09-29 14:55:05 -05:00
Matej Bukovinski 766b92a9b4 Fixed version info in the header. 2010-08-02 11:55:54 +02:00
Matej Bukovinski fc8935176a Changed the default animation type to fade. 2010-07-26 09:19:14 +02:00
Matej Bukovinski 5eae2eabcd A (temporary) fix to correctly resize the HUD when rotating.
The demo app is now addidng the HUD to the navigation controller's view.
2010-07-26 08:43:51 +02:00
Fraser Speirs 1d4cd3dc3d Added license information to README from MBProgressHUD.h. 2010-05-12 23:49:57 +08:00
10 changed files with 642 additions and 454 deletions
+4
View File
@@ -11,6 +11,9 @@
@interface HudDemoViewController : UIViewController <MBProgressHUDDelegate> {
MBProgressHUD *HUD;
long long expectedLength;
long long currentLength;
}
- (IBAction)showSimple:(id)sender;
@@ -21,6 +24,7 @@
- (IBAction)showWithLabelMixed:(id)sender;
- (IBAction)showUsingBlocks:(id)sender;
- (IBAction)showOnWindow:(id)sender;
- (IBAction)showURL:(id)sender;
- (void)myTask;
- (void)myProgressTask;
+89 -77
View File
@@ -11,6 +11,9 @@
@implementation HudDemoViewController
#pragma mark -
#pragma mark Constants
#pragma mark -
#pragma mark Lifecycle methods
@@ -25,9 +28,6 @@
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// No autoroation support when adding the HUD to a window!
// In that case you need to explicitly transform the HUD if you need a rotated version (i.g.,
// self.transform = CGAffineTransformMakeRotation(PI / 2); )
return YES;
}
@@ -44,16 +44,11 @@
#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];
[self.navigationController.view addSubview:HUD];
//HUD.graceTime = 0.5;
//HUD.minShowTime = 5.0;
// Add HUD to screen
[self.view addSubview:HUD];
// Regisete for HUD callbacks so we can remove it from the window at the right time
// Regiser for HUD callbacks so we can remove it from the window at the right time
HUD.delegate = self;
// Show the HUD while the provided method executes in a new thread
@@ -61,130 +56,125 @@
}
- (IBAction)showWithLabel:(id)sender {
// The hud will dispable all input on the view
HUD = [[MBProgressHUD alloc] initWithView:self.view];
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
// Add HUD to screen
[self.view 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];
}
- (IBAction)showWithDetailsLabel:(id)sender {
// The hud will dispable all input on the view
HUD = [[MBProgressHUD alloc] initWithView:self.view];
// Add HUD to screen
[self.view addSubview:HUD];
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[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 = @"Loading";
HUD.detailsLabelText = @"updating data";
HUD.square = YES;
// Show the HUD while the provided method executes in a new thread
[HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];
}
- (IBAction)showWithLabelDeterminate:(id)sender {
// The hud will dispable all input on the view
HUD = [[MBProgressHUD alloc] initWithView:self.view];
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
// Set determinate mode
HUD.mode = MBProgressHUDModeDeterminate;
// Add HUD to screen
[self.view addSubview:HUD];
// Regisete for HUD callbacks so we can remove it from the window at the right time
HUD.delegate = self;
HUD.delegate = self;
HUD.labelText = @"Loading";
// Show the HUD while the provided method executes in a new thread
// myProgressTask uses the HUD instance to update progress
[HUD showWhileExecuting:@selector(myProgressTask) onTarget:self withObject:nil animated:YES];
}
- (IBAction)showWithCustomView:(id)sender {
// The hud will dispable all input on the view
HUD = [[MBProgressHUD alloc] initWithView:self.view];
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
// The sample image is based on the work by www.pixelpressicons.com, http://creativecommons.org/licenses/by/2.5/ca/
// The sample image is based on the work by http://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.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];
[HUD show:YES];
[HUD hide:YES afterDelay:3];
}
- (IBAction)showWithLabelMixed:(id)sender {
// The hud will dispable all input on the view
HUD = [[MBProgressHUD alloc] initWithView:self.view];
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
// Add HUD to screen
[self.view addSubview:HUD];
// Regisete for HUD callbacks so we can remove it from the window at the right time
HUD.delegate = self;
HUD.labelText = @"Connecting";
HUD.minSize = CGSizeMake(135.f, 135.f);
// Show the HUD while the provided method executes in a new thread
[HUD showWhileExecuting:@selector(myMixedTask) onTarget:self withObject:nil animated:YES];
}
- (IBAction)showUsingBlocks:(id)sender {
#ifdef __BLOCKS__
// No need to retain (just a local variable)
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
hud.labelText = @"Loading";
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.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.view animated:YES];
[MBProgressHUD hideHUDForView:self.navigationController.view animated:YES];
});
});
#endif
}
- (IBAction)showOnWindow:(id)sender {
// The hud will dispable all input on the view
// The hud will dispable all input on the window
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";
[HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];
}
- (IBAction)showURL:(id)sender {
NSURL *URL = [NSURL URLWithString:@"https://github.com/matej/MBProgressHUD/zipball/master"];
NSURLRequest *request = [NSURLRequest requestWithURL:URL];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
[connection start];
[connection release];
HUD = [[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES] retain];
}
- (IBAction)showWithGradient:(id)sender {
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
HUD.dimBackground = YES;
// Regiser for HUD callbacks so we can remove it from the window at the right time
HUD.delegate = self;
// Show the HUD while the provided method executes in a new thread
[HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];
}
@@ -195,9 +185,6 @@
- (void)myTask {
// Do something usefull in here instead of sleeping ...
sleep(3);
// Labels can be changed during the execution
//HUD.detailsLabelText = @"Something";
//sleep(3);
}
- (void)myProgressTask {
@@ -215,7 +202,7 @@
sleep(2);
// Switch to determinate mode
HUD.mode = MBProgressHUDModeDeterminate;
HUD.labelText = @"Downloading";
HUD.labelText = @"Progress";
float progress = 0.0f;
while (progress < 1.0f)
{
@@ -235,13 +222,38 @@
sleep(2);
}
#pragma mark -
#pragma mark NSURLConnectionDelegete
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
expectedLength = [response expectedContentLength];
currentLength = 0;
HUD.mode = MBProgressHUDModeDeterminate;
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
currentLength += [data length];
HUD.progress = currentLength / (float)expectedLength;
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
HUD.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark.png"]] autorelease];
HUD.mode = MBProgressHUDModeCustomView;
[HUD hide:YES afterDelay:2];
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
[HUD hide:YES];
}
#pragma mark -
#pragma mark MBProgressHUDDelegate methods
- (void)hudWasHidden {
- (void)hudWasHidden:(MBProgressHUD *)hud {
// Remove HUD from screen when the HUD was hidded
[HUD removeFromSuperview];
[HUD release];
HUD = nil;
}
@end
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

+20 -6
View File
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
@@ -19,6 +19,7 @@
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 */; };
D2A6FD1D13ABC5A200BFE4C9 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D2A6FD1C13ABC5A200BFE4C9 /* Default@2x.png */; };
D2F88CD6115E9F7F00E6DB82 /* 37x-Checkmark.png in Resources */ = {isa = PBXBuildFile; fileRef = D2F88CD5115E9F7F00E6DB82 /* 37x-Checkmark.png */; };
/* End PBXBuildFile section */
@@ -41,6 +42,7 @@
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>"; };
D2A6FD1C13ABC5A200BFE4C9 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@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 */
@@ -126,6 +128,7 @@
D277FDB711FC877E00304321 /* Icon.png */,
D277FDB811FC877E00304321 /* Icon@2x.png */,
D277FDB211FC834200304321 /* Default.png */,
D2A6FD1C13ABC5A200BFE4C9 /* Default@2x.png */,
D2F88CD5115E9F7F00E6DB82 /* 37x-Checkmark.png */,
);
name = Images;
@@ -165,9 +168,19 @@
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0420;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HudDemo" */;
compatibilityVersion = "Xcode 3.1";
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
projectRoot = "";
@@ -188,6 +201,7 @@
D277FDB311FC834200304321 /* Default.png in Resources */,
D277FDB911FC877E00304321 /* Icon.png in Resources */,
D277FDBA11FC877E00304321 /* Icon@2x.png in Resources */,
D2A6FD1D13ABC5A200BFE4C9 /* Default@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -231,6 +245,7 @@
GCC_PREFIX_HEADER = HudDemo_Prefix.pch;
INFOPLIST_FILE = Info.plist;
PRODUCT_NAME = HudDemo;
SDKROOT = iphoneos;
};
name = Release;
};
@@ -243,9 +258,9 @@
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = iphoneos4.0;
SDKROOT = iphoneos;
};
name = Debug;
};
@@ -258,8 +273,7 @@
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = iphoneos4.0;
SDKROOT = iphoneos;
};
name = Release;
};
+142 -231
View File
@@ -2,17 +2,20 @@
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">528</int>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">788</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.SystemVersion">10J4138</string>
<string key="IBDocument.InterfaceBuilderVersion">1306</string>
<string key="IBDocument.AppKitVersion">1038.35</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">117</string>
<string key="NS.object.0">301</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="54"/>
<string>IBUIButton</string>
<string>IBUIView</string>
<string>IBUIScrollView</string>
<string>IBProxyObject</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -23,9 +26,7 @@
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="dict.values" ref="0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -52,6 +53,8 @@
<int key="NSvFlags">294</int>
<string key="NSFrame">{{20, 20}, {280, 40}}</string>
<reference key="NSSuperview" ref="821963304"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="626654324"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -82,6 +85,8 @@
<int key="NSvFlags">294</int>
<string key="NSFrame">{{20, 68}, {280, 40}}</string>
<reference key="NSSuperview" ref="821963304"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="244375631"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -102,6 +107,8 @@
<int key="NSvFlags">294</int>
<string key="NSFrame">{{20, 116}, {280, 40}}</string>
<reference key="NSSuperview" ref="821963304"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="322519489"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -125,6 +132,8 @@
<int key="NSvFlags">294</int>
<string key="NSFrame">{{20, 164}, {280, 40}}</string>
<reference key="NSSuperview" ref="821963304"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="424785"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -145,6 +154,8 @@
<int key="NSvFlags">294</int>
<string key="NSFrame">{{20, 260}, {280, 40}}</string>
<reference key="NSSuperview" ref="821963304"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="302056160"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -165,6 +176,8 @@
<int key="NSvFlags">294</int>
<string key="NSFrame">{{20, 308}, {280, 40}}</string>
<reference key="NSSuperview" ref="821963304"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="304407605"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -172,7 +185,7 @@
<int key="IBUIContentVerticalAlignment">3</int>
<reference key="IBUIFont" ref="432819284"/>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">GCD and blocks</string>
<string key="IBUINormalTitle">Inline (blocks)</string>
<reference key="IBUIHighlightedTitleColor" ref="434568641"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
@@ -185,6 +198,8 @@
<int key="NSvFlags">294</int>
<string key="NSFrame">{{20, 356}, {280, 40}}</string>
<reference key="NSSuperview" ref="821963304"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="295510578"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -200,11 +215,35 @@
</object>
<reference key="IBUINormalTitleShadowColor" ref="612289531"/>
</object>
<object class="IBUIButton" id="295510578">
<reference key="NSNextResponder" ref="821963304"/>
<int key="NSvFlags">294</int>
<string key="NSFrame">{{20, 404}, {280, 40}}</string>
<reference key="NSSuperview" ref="821963304"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="8005370"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">3</int>
<reference key="IBUIFont" ref="432819284"/>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">NSURLConnection</string>
<reference key="IBUIHighlightedTitleColor" ref="434568641"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="612289531"/>
</object>
<object class="IBUIButton" id="424785">
<reference key="NSNextResponder" ref="821963304"/>
<int key="NSvFlags">294</int>
<string key="NSFrame">{{20, 212}, {280, 40}}</string>
<reference key="NSSuperview" ref="821963304"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="319652209"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -220,9 +259,33 @@
</object>
<reference key="IBUINormalTitleShadowColor" ref="612289531"/>
</object>
<object class="IBUIButton" id="8005370">
<reference key="NSNextResponder" ref="821963304"/>
<int key="NSvFlags">294</int>
<string key="NSFrame">{{20, 451}, {280, 40}}</string>
<reference key="NSSuperview" ref="821963304"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">3</int>
<reference key="IBUIFont" ref="432819284"/>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">With Gradient</string>
<reference key="IBUIHighlightedTitleColor" ref="434568641"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="612289531"/>
</object>
</object>
<string key="NSFrameSize">{320, 416}</string>
<string key="NSFrameSize">{320, 501}</string>
<reference key="NSSuperview" ref="560298147"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="960472997"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC44ODYyNzQ1MDk4IDAuOTA1ODgyMzUyOSAwLjkyOTQxMTc2NDcAA</bytes>
@@ -232,8 +295,10 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<string key="NSFrameSize">{320, 460}</string>
<string key="NSFrameSize">{320, 501}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="821963304"/>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -322,6 +387,24 @@
</object>
<int key="connectionID">73</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">showURL:</string>
<reference key="source" ref="295510578"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">78</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">showWithGradient:</string>
<reference key="source" ref="8005370"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">81</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -357,20 +440,22 @@
<reference key="object" ref="821963304"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="960472997"/>
<reference ref="626654324"/>
<reference ref="244375631"/>
<reference ref="322519489"/>
<reference ref="319652209"/>
<reference ref="302056160"/>
<reference ref="424785"/>
<reference ref="304407605"/>
<reference ref="302056160"/>
<reference ref="960472997"/>
<reference ref="626654324"/>
<reference ref="295510578"/>
<reference ref="8005370"/>
</object>
<reference key="parent" ref="560298147"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="960472997"/>
<int key="objectID">76</int>
<reference key="object" ref="295510578"/>
<reference key="parent" ref="821963304"/>
</object>
<object class="IBObjectRecord">
@@ -379,18 +464,8 @@
<reference key="parent" ref="821963304"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">10</int>
<reference key="object" ref="244375631"/>
<reference key="parent" ref="821963304"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">16</int>
<reference key="object" ref="322519489"/>
<reference key="parent" ref="821963304"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">20</int>
<reference key="object" ref="319652209"/>
<int key="objectID">8</int>
<reference key="object" ref="960472997"/>
<reference key="parent" ref="821963304"/>
</object>
<object class="IBObjectRecord">
@@ -398,14 +473,34 @@
<reference key="object" ref="302056160"/>
<reference key="parent" ref="821963304"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">71</int>
<reference key="object" ref="304407605"/>
<reference key="parent" ref="821963304"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">43</int>
<reference key="object" ref="424785"/>
<reference key="parent" ref="821963304"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">71</int>
<reference key="object" ref="304407605"/>
<int key="objectID">20</int>
<reference key="object" ref="319652209"/>
<reference key="parent" ref="821963304"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">16</int>
<reference key="object" ref="322519489"/>
<reference key="parent" ref="821963304"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">10</int>
<reference key="object" ref="244375631"/>
<reference key="parent" ref="821963304"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">79</int>
<reference key="object" ref="8005370"/>
<reference key="parent" ref="821963304"/>
</object>
</object>
@@ -426,6 +521,8 @@
<string>54.IBEditorWindowLastContentRect</string>
<string>54.IBPluginDependency</string>
<string>71.IBPluginDependency</string>
<string>76.IBPluginDependency</string>
<string>79.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
<string>9.IBPluginDependency</string>
</object>
@@ -445,25 +542,23 @@
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="dict.values" ref="0"/>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">73</int>
<int key="maxID">81</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -477,6 +572,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>showOnWindow:</string>
<string>showSimple:</string>
<string>showURL:</string>
<string>showUsingBlocks:</string>
<string>showWithCustomView:</string>
<string>showWithDetailsLabel:</string>
@@ -494,6 +590,7 @@
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
@@ -502,6 +599,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>showOnWindow:</string>
<string>showSimple:</string>
<string>showURL:</string>
<string>showUsingBlocks:</string>
<string>showWithCustomView:</string>
<string>showWithDetailsLabel:</string>
@@ -519,6 +617,10 @@
<string key="name">showSimple:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">showURL:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">showUsingBlocks:</string>
<string key="candidateClassName">id</string>
@@ -547,197 +649,7 @@
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">Classes/HudDemoViewController.h</string>
</object>
</object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="556400071">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIButton</string>
<string key="superclassName">UIControl</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIButton.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIControl</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIControl.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIResponder</string>
<string key="superclassName">NSObject</string>
<reference key="sourceIdentifier" ref="556400071"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIScrollView</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIScrollView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UISearchBar</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UISearchDisplayController</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIView</string>
<string key="superclassName">UIResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIPopoverController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISplitViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<string key="superclassName">UIResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
<string key="minorKey">./Classes/HudDemoViewController.h</string>
</object>
</object>
</object>
@@ -757,8 +669,7 @@
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">HudDemo.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">117</string>
<string key="IBCocoaTouchPluginVersion">301</string>
</data>
</archive>
+12
View File
@@ -10,6 +10,11 @@
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIconFiles</key>
<array>
<string>Icon.png</string>
<string>Icon@2x.png</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.bukovinski.${PRODUCT_NAME:identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
@@ -26,5 +31,12 @@
<true/>
<key>NSMainNibFile</key>
<string>MainWindow</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
Regular → Executable
+112 -39
View File
@@ -1,12 +1,12 @@
//
// MBProgressHUD.h
// Version 0.33
// Version 0.4
// Created by Matej Bukovinski on 2.4.09.
//
// This code is distributed under the terms and conditions of the MIT license.
// Copyright (c) 2009 Matej Bukovinski
// Copyright (c) 2011 Matej Bukovinski
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -28,6 +28,8 @@
#import <UIKit/UIKit.h>
@protocol MBProgressHUDDelegate;
/////////////////////////////////////////////////////////////////////////////////////////////
typedef enum {
@@ -48,34 +50,6 @@ typedef enum {
/////////////////////////////////////////////////////////////////////////////////////////////
@protocol MBProgressHUDDelegate <NSObject>
@required
/**
* A callback function that is called after the HUD was fully hidden from the screen.
*/
- (void)hudWasHidden;
@end
/////////////////////////////////////////////////////////////////////////////////////////////
/**
* A progress view for showing definite progress by filling up a circle (similar to the indicator for building in xcode).
*/
@interface MBRoundProgressView : UIProgressView {}
/**
* Create a 37 by 37 pixel indicator.
* This is the same size as used by the larger UIActivityIndicatorView.
*/
- (id)initWithDefaultSize;
@end
/////////////////////////////////////////////////////////////////////////////////////////////
/**
* Displays a simple HUD window containing a progress indicator and two optional labels for short messages.
*
@@ -110,6 +84,13 @@ typedef enum {
float width;
float height;
CGSize minSize;
BOOL square;
float margin;
BOOL dimBackground;
BOOL taskInProgress;
float graceTime;
float minShowTime;
@@ -123,8 +104,12 @@ typedef enum {
float progress;
#if __has_feature(objc_arc)
id<MBProgressHUDDelegate> __weak delegate;
#else
id<MBProgressHUDDelegate> delegate;
NSString *labelText;
#endif
NSString *labelText;
NSString *detailsLabelText;
float opacity;
UIFont *labelFont;
@@ -139,7 +124,7 @@ typedef enum {
}
/**
* Creates a new hud, adds it to provided view and shows it. The counterpart to this method is hideHUDForView:animated:.
* Creates a new HUD, adds it to provided view and shows it. The counterpart to this method is hideHUDForView:animated:.
*
* @param view The view that the HUD will be added to
* @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use
@@ -151,7 +136,7 @@ typedef enum {
+ (MBProgressHUD *)showHUDAddedTo:(UIView *)view animated:(BOOL)animated;
/**
* Finds a HUD sibview and hides it. The counterpart to this method is showHUDAddedTo:animated:.
* Finds a HUD subview and hides it. The counterpart to this method is showHUDAddedTo:animated:.
*
* @param view The view that is going to be searched for a HUD subview.
* @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use
@@ -184,8 +169,11 @@ typedef enum {
* The UIView (i.g., a UIIMageView) to be shown when the HUD is in MBProgressHUDModeCustomView.
* For best results use a 37 by 37 pixel view (so the bounds match the build in indicator bounds).
*/
#if __has_feature(objc_arc)
@property (strong) UIView *customView;
#else
@property (retain) UIView *customView;
#endif
/**
* MBProgressHUD operation mode. Switches between indeterminate (MBProgressHUDModeIndeterminate) and determinate
* progress (MBProgressHUDModeDeterminate). The default is MBProgressHUDModeIndeterminate.
@@ -206,8 +194,11 @@ typedef enum {
* delegate should conform to the MBProgressHUDDelegate protocol and implement the hudWasHidden method. The delegate
* object will not be retained.
*/
#if __has_feature(objc_arc)
@property (weak) id<MBProgressHUDDelegate> delegate;
#else
@property (assign) id<MBProgressHUDDelegate> delegate;
#endif
/**
* An optional short message to be displayed below the activity indicator. The HUD is automatically resized to fit
* the entire text. If the text is too long it will get clipped by displaying "..." at the end. If left unchanged or
@@ -232,10 +223,22 @@ typedef enum {
@property (assign) float xOffset;
/**
*The y-ayis offset of the HUD relative to the centre of the superview.
* The y-ayis offset of the HUD relative to the centre of the superview.
*/
@property (assign) float yOffset;
/**
* The amounth of space between the HUD edge and the HUD elements (labels, indicators or custom views).
*
* Defaults to 20.0
*/
@property (assign) float margin;
/**
* Cover the HUD background view with a radial gradient.
*/
@property (assign) BOOL dimBackground;
/*
* Grace period is the time (in seconds) that the invoked method may be run without
* showing the HUD. If the task finishes befor the grace time runs out, the HUD will
@@ -274,30 +277,51 @@ typedef enum {
/**
* Font to be used for the main label. Set this property if the default is not adequate.
*/
#if __has_feature(objc_arc)
@property (strong) UIFont* labelFont;
#else
@property (retain) UIFont* labelFont;
#endif
/**
* Font to be used for the details label. Set this property if the default is not adequate.
*/
#if __has_feature(objc_arc)
@property (strong) UIFont* detailsLabelFont;
#else
@property (retain) UIFont* detailsLabelFont;
#endif
/**
* The progress of the progress indicator, from 0.0 to 1.0. Defaults to 0.0.
*/
@property (assign) float progress;
/**
* The minimum size of the HUD bezel. Defaults to CGSizeZero.
*/
@property (assign) CGSize minSize;
/**
* Force the HUD dimensions to be equal if possible.
*/
@property (assign, getter = isSquare) BOOL square;
/**
* Display the HUD. You need to make sure that the main thread completes its run loop soon after this method call so
* the user interface can be updated. Call this method when your task is already set-up to be executed in a new thread
* (e.g., when using something like NSOperation or calling an asynchronous call like NSUrlRequest).
*
* If you need to perform a blocking thask on the main thread, you can try spining the run loop imeidiately after calling this
* method by using:
*
* [[NSRunLoop currentRunLoop] runUntilDate:[NSDate distantPast]];
*
* @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use
* animations while disappearing.
*/
- (void)show:(BOOL)animated;
/**
* Hide the HUD, this still calls the hudWasHidden delegate. This is the counterpart of the hide: method. Use it to
* Hide the HUD. This still calls the hudWasHidden delegate. This is the counterpart of the hide: method. Use it to
* hide the HUD when your task completes.
*
* @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use
@@ -305,6 +329,16 @@ typedef enum {
*/
- (void)hide:(BOOL)animated;
/**
* Hide the HUD after a delay. This still calls the hudWasHidden delegate. This is the counterpart of the hide: method. Use it to
* hide the HUD when your task completes.
*
* @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use
* animations while disappearing.
* @param delay Delay in secons until the HUD is hidden.
*/
- (void)hide:(BOOL)animated afterDelay:(NSTimeInterval)delay;
/**
* Shows the HUD while a background task is executing in a new thread, then hides the HUD.
*
@@ -320,3 +354,42 @@ typedef enum {
- (void)showWhileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated;
@end
/////////////////////////////////////////////////////////////////////////////////////////////
@protocol MBProgressHUDDelegate <NSObject>
@optional
/**
* Called after the HUD was fully hidden from the screen.
*/
- (void)hudWasHidden:(MBProgressHUD *)hud;
/**
* @deprecated use hudWasHidden: instead
* @see hudWasHidden:
*/
- (void)hudWasHidden __attribute__ ((deprecated));
@end
/////////////////////////////////////////////////////////////////////////////////////////////
/**
* A progress view for showing definite progress by filling up a circle (pie chart).
*/
@interface MBRoundProgressView : UIView {
@private
float _progress;
}
/**
* Progress (0.0 to 1.0)
*/
@property (nonatomic, assign) float progress;
@end
/////////////////////////////////////////////////////////////////////////////////////////////
Regular → Executable
+245 -99
View File
@@ -1,6 +1,6 @@
//
// MBProgressHUD.m
// Version 0.33
// Version 0.4
// Created by Matej Bukovinski on 2.4.09.
//
@@ -10,7 +10,6 @@
- (void)hideUsingAnimation:(BOOL)animated;
- (void)showUsingAnimation:(BOOL)animated;
- (void)fillRoundedRect:(CGRect)rect inContext:(CGContextRef)context;
- (void)done;
- (void)updateLabelText:(NSString *)newText;
- (void)updateDetailsLabelText:(NSString *)newText;
@@ -19,13 +18,27 @@
- (void)handleGraceTimer:(NSTimer *)theTimer;
- (void)handleMinShowTimer:(NSTimer *)theTimer;
- (void)setTransformForCurrentOrientation:(BOOL)animated;
- (void)cleanUp;
- (void)launchExecution;
- (void)deviceOrientationDidChange:(NSNotification *)notification;
- (void)hideDelayed:(NSNumber *)animated;
- (void)launchExecution;
- (void)cleanUp;
#if __has_feature(objc_arc)
@property (strong) UIView *indicator;
@property (strong) NSTimer *graceTimer;
@property (strong) NSTimer *minShowTimer;
@property (strong) NSDate *showStarted;
#else
@property (retain) UIView *indicator;
@property (assign) float width;
@property (assign) float height;
@property (retain) NSTimer *graceTimer;
@property (retain) NSTimer *minShowTimer;
@property (retain) NSDate *showStarted;
#endif
@property (assign) float width;
@property (assign) float height;
@end
@@ -48,6 +61,10 @@
@synthesize height;
@synthesize xOffset;
@synthesize yOffset;
@synthesize minSize;
@synthesize square;
@synthesize margin;
@synthesize dimBackground;
@synthesize graceTime;
@synthesize minShowTime;
@@ -139,14 +156,18 @@
- (void)updateLabelText:(NSString *)newText {
if (labelText != newText) {
#if !__has_feature(objc_arc)
[labelText release];
#endif
labelText = [newText copy];
}
}
- (void)updateDetailsLabelText:(NSString *)newText {
if (detailsLabelText != newText) {
#if !__has_feature(objc_arc)
[detailsLabelText release];
#endif
detailsLabelText = [newText copy];
}
}
@@ -161,13 +182,22 @@
}
if (mode == MBProgressHUDModeDeterminate) {
self.indicator = [[[MBRoundProgressView alloc] initWithDefaultSize] autorelease];
}
#if __has_feature(objc_arc)
self.indicator = [[MBRoundProgressView alloc] init];
#else
self.indicator = [[[MBRoundProgressView alloc] init] autorelease];
#endif
}
else if (mode == MBProgressHUDModeCustomView && self.customView != nil){
self.indicator = self.customView;
} else {
#if __has_feature(objc_arc)
self.indicator = [[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
#else
self.indicator = [[[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge] autorelease];
#endif
[(UIActivityIndicatorView *)indicator startAnimating];
}
@@ -178,14 +208,10 @@
#pragma mark -
#pragma mark Constants
#define MARGIN 20.0
#define PADDING 4.0
#define LABELFONTSIZE 16.0
#define LABELDETAILSFONTSIZE 12.0
#define PI 3.14159265358979323846
#define PADDING 4.0f
#define LABELFONTSIZE 16.0f
#define LABELDETAILSFONTSIZE 12.0f
#pragma mark -
#pragma mark Class methods
@@ -194,7 +220,11 @@
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:view];
[view addSubview:hud];
[hud show:animated];
#if __has_feature(objc_arc)
return hud;
#else
return [hud autorelease];
#endif
}
+ (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated {
@@ -232,28 +262,42 @@
// We need to take care of rotation ourselfs if we're adding the HUD to a window
if ([view isKindOfClass:[UIWindow class]]) {
[self setTransformForCurrentOrientation:NO];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange:)
name:UIDeviceOrientationDidChangeNotification object:nil];
}
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange:)
name:UIDeviceOrientationDidChangeNotification object:nil];
return me;
}
- (void)removeFromSuperview {
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIDeviceOrientationDidChangeNotification
object:nil];
[super removeFromSuperview];
}
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self = [super initWithFrame:frame];
if (self) {
// Set default values for properties
self.animationType = MBProgressHUDAnimationZoom;
self.animationType = MBProgressHUDAnimationFade;
self.mode = MBProgressHUDModeIndeterminate;
self.labelText = nil;
self.detailsLabelText = nil;
self.opacity = 0.8;
self.opacity = 0.8f;
self.labelFont = [UIFont boldSystemFontOfSize:LABELFONTSIZE];
self.detailsLabelFont = [UIFont boldSystemFontOfSize:LABELDETAILSFONTSIZE];
self.xOffset = 0.0;
self.yOffset = 0.0;
self.graceTime = 0.0;
self.minShowTime = 0.0;
self.xOffset = 0.0f;
self.yOffset = 0.0f;
self.dimBackground = NO;
self.margin = 20.0f;
self.graceTime = 0.0f;
self.minShowTime = 0.0f;
self.removeFromSuperViewOnHide = NO;
self.minSize = CGSizeZero;
self.square = NO;
self.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
@@ -262,7 +306,7 @@
self.backgroundColor = [UIColor clearColor];
// Make invisible for now
self.alpha = 0.0;
self.alpha = 0.0f;
// Add label
label = [[UILabel alloc] initWithFrame:self.bounds];
@@ -276,9 +320,8 @@
return self;
}
#if !__has_feature(objc_arc)
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[indicator release];
[label release];
[detailsLabel release];
@@ -290,6 +333,7 @@
[customView release];
[super dealloc];
}
#endif
#pragma mark -
#pragma mark Layout
@@ -299,12 +343,12 @@
// Compute HUD dimensions based on indicator size (add margin to HUD border)
CGRect indFrame = indicator.bounds;
self.width = indFrame.size.width + 2 * MARGIN;
self.height = indFrame.size.height + 2 * MARGIN;
self.width = indFrame.size.width + 2 * margin;
self.height = indFrame.size.height + 2 * margin;
// Position the indicator
indFrame.origin.x = floor((frame.size.width - indFrame.size.width) / 2) + self.xOffset;
indFrame.origin.y = floor((frame.size.height - indFrame.size.height) / 2) + self.yOffset;
indFrame.origin.x = floorf((frame.size.width - indFrame.size.width) / 2) + self.xOffset;
indFrame.origin.y = floorf((frame.size.height - indFrame.size.height) / 2) + self.yOffset;
indicator.frame = indFrame;
// Add label if label text was set
@@ -315,11 +359,11 @@
// Compute label dimensions based on font metrics if size is larger than max then clip the label width
float lHeight = dims.height;
float lWidth;
if (dims.width <= (frame.size.width - 2 * MARGIN)) {
if (dims.width <= (frame.size.width - 4 * margin)) {
lWidth = dims.width;
}
else {
lWidth = frame.size.width - 4 * MARGIN;
lWidth = frame.size.width - 4 * margin;
}
// Set label properties
@@ -332,18 +376,18 @@
label.text = self.labelText;
// Update HUD size
if (self.width < (lWidth + 2 * MARGIN)) {
self.width = lWidth + 2 * MARGIN;
if (self.width < (lWidth + 2 * margin)) {
self.width = lWidth + 2 * margin;
}
self.height = self.height + lHeight + PADDING;
// Move indicator to make room for the label
indFrame.origin.y -= (floor(lHeight / 2 + PADDING / 2));
indFrame.origin.y -= (floorf(lHeight / 2 + PADDING / 2));
indicator.frame = indFrame;
// Set the label position and dimensions
CGRect lFrame = CGRectMake(floor((frame.size.width - lWidth) / 2) + xOffset,
floor(indFrame.origin.y + indFrame.size.height + PADDING),
CGRect lFrame = CGRectMake(floorf((frame.size.width - lWidth) / 2) + xOffset,
floorf(indFrame.origin.y + indFrame.size.height + PADDING),
lWidth, lHeight);
label.frame = lFrame;
@@ -351,17 +395,6 @@
// Add details label delatils text was set
if (nil != self.detailsLabelText) {
// Get size of label text
dims = [self.detailsLabelText sizeWithFont:self.detailsLabelFont];
// Compute label dimensions based on font metrics if size is larger than max then clip the label width
lHeight = dims.height;
if (dims.width <= (frame.size.width - 2 * MARGIN)) {
lWidth = dims.width;
}
else {
lWidth = frame.size.width - 4 * MARGIN;
}
// Set label properties
detailsLabel.font = self.detailsLabelFont;
@@ -371,29 +404,52 @@
detailsLabel.backgroundColor = [UIColor clearColor];
detailsLabel.textColor = [UIColor whiteColor];
detailsLabel.text = self.detailsLabelText;
detailsLabel.numberOfLines = 0;
CGFloat maxHeight = frame.size.height - self.height - 2*margin;
CGSize labelSize = [detailsLabel.text sizeWithFont:detailsLabel.font constrainedToSize:CGSizeMake(frame.size.width - 4*margin, maxHeight) lineBreakMode:detailsLabel.lineBreakMode];
lHeight = labelSize.height;
lWidth = labelSize.width;
// Update HUD size
if (self.width < lWidth) {
self.width = lWidth + 2 * MARGIN;
self.width = lWidth + 2 * margin;
}
self.height = self.height + lHeight + PADDING;
// Move indicator to make room for the new label
indFrame.origin.y -= (floor(lHeight / 2 + PADDING / 2));
indFrame.origin.y -= (floorf(lHeight / 2 + PADDING / 2));
indicator.frame = indFrame;
// Move first label to make room for the new label
lFrame.origin.y -= (floor(lHeight / 2 + PADDING / 2));
lFrame.origin.y -= (floorf(lHeight / 2 + PADDING / 2));
label.frame = lFrame;
// Set label position and dimensions
CGRect lFrameD = CGRectMake(floor((frame.size.width - lWidth) / 2) + xOffset,
CGRect lFrameD = CGRectMake(floorf((frame.size.width - lWidth) / 2) + xOffset,
lFrame.origin.y + lFrame.size.height + PADDING, lWidth, lHeight);
detailsLabel.frame = lFrameD;
[self addSubview:detailsLabel];
}
}
if (square) {
CGFloat max = MAX(self.width, self.height);
if (max <= frame.size.width - 2*margin) {
self.width = max;
}
if (max <= frame.size.height - 2*margin) {
self.height = max;
}
}
if (self.width < minSize.width) {
self.width = minSize.width;
}
if (self.height < minSize.height) {
self.height = minSize.height;
}
}
#pragma mark -
@@ -438,6 +494,14 @@
[self hideUsingAnimation:useAnimation];
}
- (void)hide:(BOOL)animated afterDelay:(NSTimeInterval)delay {
[self performSelector:@selector(hideDelayed:) withObject:[NSNumber numberWithBool:animated] afterDelay:delay];
}
- (void)hideDelayed:(NSNumber *)animated {
[self hide:[animated boolValue]];
}
- (void)handleGraceTimer:(NSTimer *)theTimer {
// Show the HUD only if the task is still running
if (taskInProgress) {
@@ -453,9 +517,14 @@
- (void)showWhileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated {
methodForExecution = method;
#if __has_feature(objc_arc)
targetForExecution = target;
objectForExecution = object;
#else
targetForExecution = [target retain];
objectForExecution = [object retain];
#endif
// Launch execution in new thread
taskInProgress = YES;
[NSThread detachNewThreadSelector:@selector(launchExecution) toTarget:self withObject:nil];
@@ -465,16 +534,21 @@
}
- (void)launchExecution {
#if !__has_feature(objc_arc)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#endif
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
// Start executing the requested task
[targetForExecution performSelector:methodForExecution withObject:objectForExecution];
#pragma clang diagnostic pop
// Task completed, update view in main thread (note: view operations should
// be done only in the main thread)
[self performSelectorOnMainThread:@selector(cleanUp) withObject:nil waitUntilDone:NO];
#if !__has_feature(objc_arc)
[pool release];
#endif
}
- (void)animationFinished:(NSString *)animationID finished:(BOOL)finished context:(void*)context {
@@ -485,13 +559,15 @@
isFinished = YES;
// If delegate was set make the callback
self.alpha = 0.0;
self.alpha = 0.0f;
if(delegate != nil && [delegate conformsToProtocol:@protocol(MBProgressHUDDelegate)]) {
if([delegate respondsToSelector:@selector(hudWasHidden)]) {
[delegate performSelector:@selector(hudWasHidden)];
}
}
if(delegate != nil) {
if ([delegate respondsToSelector:@selector(hudWasHidden:)]) {
[delegate performSelector:@selector(hudWasHidden:) withObject:self];
} else if ([delegate respondsToSelector:@selector(hudWasHidden)]) {
[delegate performSelector:@selector(hudWasHidden)];
}
}
if (removeFromSuperViewOnHide) {
[self removeFromSuperview];
@@ -503,8 +579,10 @@
self.indicator = nil;
#if !__has_feature(objc_arc)
[targetForExecution release];
[objectForExecution release];
#endif
[self hide:useAnimation];
}
@@ -513,9 +591,9 @@
#pragma mark Fade in and Fade out
- (void)showUsingAnimation:(BOOL)animated {
self.alpha = 0.0;
self.alpha = 0.0f;
if (animated && animationType == MBProgressHUDAnimationZoom) {
self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(1.5, 1.5));
self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(1.5f, 1.5f));
}
self.showStarted = [NSDate date];
@@ -523,14 +601,14 @@
if (animated) {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.30];
self.alpha = 1.0;
self.alpha = 1.0f;
if (animationType == MBProgressHUDAnimationZoom) {
self.transform = rotationTransform;
}
[UIView commitAnimations];
}
else {
self.alpha = 1.0;
self.alpha = 1.0f;
}
}
@@ -544,13 +622,13 @@
// 0.02 prevents the hud from passing through touches during the animation the hud will get completely hidden
// in the done method
if (animationType == MBProgressHUDAnimationZoom) {
self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(0.5, 0.5));
self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(0.5f, 0.5f));
}
self.alpha = 0.02;
self.alpha = 0.02f;
[UIView commitAnimations];
}
else {
self.alpha = 0.0;
self.alpha = 0.0f;
[self done];
}
}
@@ -558,25 +636,44 @@
#pragma mark BG Drawing
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
if (dimBackground) {
//Gradient colours
size_t gradLocationsNum = 2;
CGFloat gradLocations[2] = {0.0f, 1.0f};
CGFloat gradColors[8] = {0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.75f};
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, gradColors, gradLocations, gradLocationsNum);
CGColorSpaceRelease(colorSpace);
//Gradient center
CGPoint gradCenter= CGPointMake(self.bounds.size.width/2, self.bounds.size.height/2);
//Gradient radius
float gradRadius = MIN(self.bounds.size.width , self.bounds.size.height) ;
//Gradient draw
CGContextDrawRadialGradient (context, gradient, gradCenter,
0, gradCenter, gradRadius,
kCGGradientDrawsAfterEndLocation);
CGGradientRelease(gradient);
}
// Center HUD
CGRect allRect = self.bounds;
// Draw rounded HUD bacgroud rect
CGRect boxRect = CGRectMake(((allRect.size.width - self.width) / 2) + self.xOffset,
((allRect.size.height - self.height) / 2) + self.yOffset, self.width, self.height);
CGContextRef ctxt = UIGraphicsGetCurrentContext();
[self fillRoundedRect:boxRect inContext:ctxt];
}
- (void)fillRoundedRect:(CGRect)rect inContext:(CGContextRef)context {
float radius = 10.0f;
CGRect boxRect = CGRectMake(roundf((allRect.size.width - self.width) / 2) + self.xOffset,
roundf((allRect.size.height - self.height) / 2) + self.yOffset, self.width, self.height);
// Corner radius
float radius = 10.0f;
CGContextBeginPath(context);
CGContextSetGrayFillColor(context, 0.0, self.opacity);
CGContextMoveToPoint(context, CGRectGetMinX(rect) + radius, CGRectGetMinY(rect));
CGContextAddArc(context, CGRectGetMaxX(rect) - radius, CGRectGetMinY(rect) + radius, radius, 3 * M_PI / 2, 0, 0);
CGContextAddArc(context, CGRectGetMaxX(rect) - radius, CGRectGetMaxY(rect) - radius, radius, 0, M_PI / 2, 0);
CGContextAddArc(context, CGRectGetMinX(rect) + radius, CGRectGetMaxY(rect) - radius, radius, M_PI / 2, M_PI, 0);
CGContextAddArc(context, CGRectGetMinX(rect) + radius, CGRectGetMinY(rect) + radius, radius, M_PI, 3 * M_PI / 2, 0);
CGContextSetGrayFillColor(context, 0.0f, self.opacity);
CGContextMoveToPoint(context, CGRectGetMinX(boxRect) + radius, CGRectGetMinY(boxRect));
CGContextAddArc(context, CGRectGetMaxX(boxRect) - radius, CGRectGetMinY(boxRect) + radius, radius, 3 * (float)M_PI / 2, 0, 0);
CGContextAddArc(context, CGRectGetMaxX(boxRect) - radius, CGRectGetMaxY(boxRect) - radius, radius, 0, (float)M_PI / 2, 0);
CGContextAddArc(context, CGRectGetMinX(boxRect) + radius, CGRectGetMaxY(boxRect) - radius, radius, (float)M_PI / 2, (float)M_PI, 0);
CGContextAddArc(context, CGRectGetMinX(boxRect) + radius, CGRectGetMinY(boxRect) + radius, radius, (float)M_PI, 3 * (float)M_PI / 2, 0);
CGContextClosePath(context);
CGContextFillPath(context);
}
@@ -584,19 +681,36 @@
#pragma mark -
#pragma mark Manual oritentation change
#define RADIANS(degrees) ((degrees * M_PI) / 180.0)
#define RADIANS(degrees) ((degrees * (float)M_PI) / 180.0f)
- (void)deviceOrientationDidChange:(NSNotification *)notification {
[self setTransformForCurrentOrientation:YES];
if (!self.superview) {
return;
}
if ([self.superview isKindOfClass:[UIWindow class]]) {
[self setTransformForCurrentOrientation:YES];
} else {
self.bounds = self.superview.bounds;
[self setNeedsDisplay];
}
}
- (void)setTransformForCurrentOrientation:(BOOL)animated {
UIDeviceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
NSInteger degrees = 0;
// Stay in sync with the superview
if (self.superview) {
self.bounds = self.superview.bounds;
[self setNeedsDisplay];
}
if (UIInterfaceOrientationIsLandscape(orientation)) {
if (orientation == UIInterfaceOrientationLandscapeLeft) { degrees = -90; }
else { degrees = 90; }
// Window coordinates differ!
self.bounds = CGRectMake(0, 0, self.bounds.size.height, self.bounds.size.width);
} else {
if (orientation == UIInterfaceOrientationPortraitUpsideDown) { degrees = 180; }
else { degrees = 0; }
@@ -615,35 +729,67 @@
@end
/////////////////////////////////////////////////////////////////////////////////////////////
@implementation MBRoundProgressView
- (id)initWithDefaultSize {
return [super initWithFrame:CGRectMake(0.0f, 0.0f, 37.0f, 37.0f)];
#pragma mark -
#pragma mark Accessors
- (float)progress {
return _progress;
}
- (void)setProgress:(float)progress {
_progress = progress;
[self setNeedsDisplay];
}
#pragma mark -
#pragma mark Lifecycle
- (id)init {
return [self initWithFrame:CGRectMake(0.0f, 0.0f, 37.0f, 37.0f)];
}
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [UIColor clearColor];
self.opaque = NO;
}
return self;
}
#pragma mark -
#pragma mark Drawing
- (void)drawRect:(CGRect)rect {
CGRect allRect = self.bounds;
CGRect circleRect = CGRectMake(allRect.origin.x + 2, allRect.origin.y + 2, allRect.size.width - 4,
allRect.size.height - 4);
CGRect circleRect = CGRectInset(allRect, 2.0f, 2.0f);
CGContextRef context = UIGraphicsGetCurrentContext();
// Draw background
CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); // white
CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 0.1); // translucent white
CGContextSetLineWidth(context, 2.0);
CGContextSetRGBStrokeColor(context, 1.0f, 1.0f, 1.0f, 1.0f); // white
CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 0.1f); // translucent white
CGContextSetLineWidth(context, 2.0f);
CGContextFillEllipseInRect(context, circleRect);
CGContextStrokeEllipseInRect(context, circleRect);
// Draw progress
float x = (allRect.size.width / 2);
float y = (allRect.size.height / 2);
CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0); // white
CGContextMoveToPoint(context, x, y);
CGContextAddArc(context, x, y, (allRect.size.width - 4) / 2, -(PI / 2), (self.progress * 2 * PI) - PI / 2, 0);
CGPoint center = CGPointMake(allRect.size.width / 2, allRect.size.height / 2);
CGFloat radius = (allRect.size.width - 4) / 2;
CGFloat startAngle = - ((float)M_PI / 2); // 90 degrees
CGFloat endAngle = (self.progress * 2 * (float)M_PI) + startAngle;
CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f); // white
CGContextMoveToPoint(context, center.x, center.y);
CGContextAddArc(context, center.x, center.y, radius, startAngle, endAngle, 0);
CGContextClosePath(context);
CGContextFillPath(context);
}
@end
/////////////////////////////////////////////////////////////////////////////////////////////
+18 -2
View File
@@ -31,13 +31,29 @@ If you have a git tracked project, you can add MBProgressHUD as a submodule to y
Usage
=====
A full Xcode demo project is included in the Demo directory. This should give you an idea how to use the class.
Extensive documentation is provided in the header file (MBProgressHUD.h). In additiona a full Xcode demo project is included in the Demo directory.
License
=======
This code is distributed under the terms and conditions of the MIT license.
Copyright (c) 2011 Matej Bukovinski
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Extensive documentation is provided in the header file (MBProgressHUD.h).
Change-log
==========
**Version 0.41** @ 03.01.12
- Support for ARC.
**Version 0.4** @ 25.07.10
- Different animation modes. Default set to zoom.