Skip to content

Commit

Permalink
Add colored HUD to demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Angelina Fabbro authored and matej committed Jul 5, 2012
1 parent d1d331a commit 6bba10e
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 4 deletions.
11 changes: 11 additions & 0 deletions Demo/Classes/HudDemoViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,17 @@ - (IBAction)showTextOnly:(id)sender {
[hud hide:YES afterDelay:3];
}

- (IBAction)showWithColor:(id)sender{
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];

// Set the hud to display with a color
HUD.color = [UIColor colorWithRed:0.23 green:0.50 blue:0.82 alpha:0.90].CGColor;

HUD.delegate = self;
[HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];
}

#pragma mark -
#pragma mark Execution code

Expand Down
56 changes: 53 additions & 3 deletions Demo/en.lproj/HudDemoViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@
<string key="NSFrame">{{20, 547}, {280, 40}}</string>
<reference key="NSSuperview" ref="821963304"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="952034185"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
Expand All @@ -338,8 +339,40 @@
<reference key="IBUIFontDescription" ref="931117317"/>
<reference key="IBUIFont" ref="432819284"/>
</object>
<object class="IBUIButton" id="952034185">
<reference key="NSNextResponder" ref="821963304"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 595}, {280, 37}}</string>
<reference key="NSSuperview" ref="821963304"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Colored</string>
<object class="NSColor" key="IBUIHighlightedTitleColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleShadowColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">2</int>
<double key="pointSize">15</double>
</object>
<reference key="IBUIFont" ref="432819284"/>
</object>
</object>
<string key="NSFrameSize">{320, 607}</string>
<string key="NSFrameSize">{320, 649}</string>
<reference key="NSSuperview" ref="560298147"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="960472997"/>
Expand All @@ -352,7 +385,7 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<string key="NSFrameSize">{320, 607}</string>
<string key="NSFrameSize">{320, 649}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="821963304"/>
Expand Down Expand Up @@ -480,6 +513,15 @@
</object>
<int key="connectionID">113</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">showWithColor:</string>
<reference key="source" ref="952034185"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">116</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
Expand Down Expand Up @@ -529,6 +571,7 @@
<reference ref="8005370"/>
<reference ref="706142914"/>
<reference ref="686140023"/>
<reference ref="952034185"/>
</object>
<reference key="parent" ref="560298147"/>
</object>
Expand Down Expand Up @@ -592,6 +635,11 @@
<reference key="object" ref="686140023"/>
<reference key="parent" ref="821963304"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">115</int>
<reference key="object" ref="952034185"/>
<reference key="parent" ref="821963304"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
Expand All @@ -605,6 +653,7 @@
<string>10.IBPluginDependency</string>
<string>106.IBPluginDependency</string>
<string>111.IBPluginDependency</string>
<string>115.IBPluginDependency</string>
<string>16.IBPluginDependency</string>
<string>20.IBPluginDependency</string>
<string>43.IBPluginDependency</string>
Expand Down Expand Up @@ -637,6 +686,7 @@
<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">
Expand All @@ -651,7 +701,7 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">114</int>
<int key="maxID">116</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand Down
1 change: 0 additions & 1 deletion MBProgressHUD.m
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,6 @@ - (void)drawRect:(CGRect)rect {
roundf((allRect.size.height - size.height) / 2) + self.yOffset, size.width, size.height);
float radius = 10.0f;
CGContextBeginPath(context);
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);
Expand Down

0 comments on commit 6bba10e

Please sign in to comment.