Bored Room Bingo
 All Classes Functions Properties
MBProgressHUD.h
1 //
2 // MBProgressHUD.h
3 // Version 0.9
4 // Created by Matej Bukovinski on 2.4.09.
5 //
6 
7 // This code is distributed under the terms and conditions of the MIT license.
8 
9 // Copyright (c) 2013 Matej Bukovinski
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining a copy
12 // of this software and associated documentation files (the "Software"), to deal
13 // in the Software without restriction, including without limitation the rights
14 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 // copies of the Software, and to permit persons to whom the Software is
16 // furnished to do so, subject to the following conditions:
17 //
18 // The above copyright notice and this permission notice shall be included in
19 // all copies or substantial portions of the Software.
20 //
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 // THE SOFTWARE.
28 
29 #import <Foundation/Foundation.h>
30 #import <UIKit/UIKit.h>
31 #import <CoreGraphics/CoreGraphics.h>
32 
33 @protocol MBProgressHUDDelegate;
34 
35 
36 typedef enum {
38  MBProgressHUDModeIndeterminate,
40  MBProgressHUDModeDeterminate,
42  MBProgressHUDModeDeterminateHorizontalBar,
44  MBProgressHUDModeAnnularDeterminate,
46  MBProgressHUDModeCustomView,
48  MBProgressHUDModeText
49 } MBProgressHUDMode;
50 
51 typedef enum {
53  MBProgressHUDAnimationFade,
55  MBProgressHUDAnimationZoom,
56  MBProgressHUDAnimationZoomOut = MBProgressHUDAnimationZoom,
57  MBProgressHUDAnimationZoomIn
58 } MBProgressHUDAnimation;
59 
60 
61 #ifndef MB_INSTANCETYPE
62 #if __has_feature(objc_instancetype)
63  #define MB_INSTANCETYPE instancetype
64 #else
65  #define MB_INSTANCETYPE id
66 #endif
67 #endif
68 
69 #ifndef MB_STRONG
70 #if __has_feature(objc_arc)
71  #define MB_STRONG strong
72 #else
73  #define MB_STRONG retain
74 #endif
75 #endif
76 
77 #ifndef MB_WEAK
78 #if __has_feature(objc_arc_weak)
79  #define MB_WEAK weak
80 #elif __has_feature(objc_arc)
81  #define MB_WEAK unsafe_unretained
82 #else
83  #define MB_WEAK assign
84 #endif
85 #endif
86 
87 #if NS_BLOCKS_AVAILABLE
88 typedef void (^MBProgressHUDCompletionBlock)();
89 #endif
90 
91 
111 @interface MBProgressHUD : UIView
112 
124 + (MB_INSTANCETYPE)showHUDAddedTo:(UIView *)view animated:(BOOL)animated;
125 
137 + (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated;
138 
150 + (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated;
151 
158 + (MB_INSTANCETYPE)HUDForView:(UIView *)view;
159 
166 + (NSArray *)allHUDsForView:(UIView *)view;
167 
175 - (id)initWithWindow:(UIWindow *)window;
176 
184 - (id)initWithView:(UIView *)view;
185 
196 - (void)show:(BOOL)animated;
197 
207 - (void)hide:(BOOL)animated;
208 
219 - (void)hide:(BOOL)animated afterDelay:(NSTimeInterval)delay;
220 
233 - (void)showWhileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated;
234 
235 #if NS_BLOCKS_AVAILABLE
236 
242 - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block;
243 
249 - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block completionBlock:(MBProgressHUDCompletionBlock)completion;
250 
256 - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue;
257 
269 - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue
270  completionBlock:(MBProgressHUDCompletionBlock)completion;
271 
275 @property (copy) MBProgressHUDCompletionBlock completionBlock;
276 
277 #endif
278 
284 @property (assign) MBProgressHUDMode mode;
285 
291 @property (assign) MBProgressHUDAnimation animationType;
292 
297 @property (MB_STRONG) UIView *customView;
298 
304 @property (MB_WEAK) id<MBProgressHUDDelegate> delegate;
305 
311 @property (copy) NSString *labelText;
312 
317 @property (copy) NSString *detailsLabelText;
318 
322 @property (assign) float opacity;
323 
329 @property (MB_STRONG) UIColor *color;
330 
334 @property (assign) float xOffset;
335 
339 @property (assign) float yOffset;
340 
345 @property (assign) float margin;
346 
351 @property (assign) float cornerRadius;
352 
356 @property (assign) BOOL dimBackground;
357 
358 /*
359  * Grace period is the time (in seconds) that the invoked method may be run without
360  * showing the HUD. If the task finishes before the grace time runs out, the HUD will
361  * not be shown at all.
362  * This may be used to prevent HUD display for very short tasks.
363  * Defaults to 0 (no grace time).
364  * Grace time functionality is only supported when the task status is known!
365  * @see taskInProgress
366  */
367 @property (assign) float graceTime;
368 
374 @property (assign) float minShowTime;
375 
384 @property (assign) BOOL taskInProgress;
385 
390 @property (assign) BOOL removeFromSuperViewOnHide;
391 
395 @property (MB_STRONG) UIFont* labelFont;
396 
400 @property (MB_STRONG) UIColor* labelColor;
401 
405 @property (MB_STRONG) UIFont* detailsLabelFont;
406 
410 @property (MB_STRONG) UIColor* detailsLabelColor;
411 
416 @property (MB_STRONG) UIColor *activityIndicatorColor;
417 
421 @property (assign) float progress;
422 
426 @property (assign) CGSize minSize;
427 
428 
434 @property (atomic, assign, readonly) CGSize size;
435 
436 
440 @property (assign, getter = isSquare) BOOL square;
441 
442 @end
443 
444 
445 @protocol MBProgressHUDDelegate <NSObject>
446 
447 @optional
448 
452 - (void)hudWasHidden:(MBProgressHUD *)hud;
453 
454 @end
455 
456 
460 @interface MBRoundProgressView : UIView
461 
465 @property (nonatomic, assign) float progress;
466 
471 @property (nonatomic, MB_STRONG) UIColor *progressTintColor;
472 
477 @property (nonatomic, MB_STRONG) UIColor *backgroundTintColor;
478 
479 /*
480  * Display mode - NO = round or YES = annular. Defaults to round.
481  */
482 @property (nonatomic, assign, getter = isAnnular) BOOL annular;
483 
484 @end
485 
486 
490 @interface MBBarProgressView : UIView
491 
495 @property (nonatomic, assign) float progress;
496 
501 @property (nonatomic, MB_STRONG) UIColor *lineColor;
502 
507 @property (nonatomic, MB_STRONG) UIColor *progressRemainingColor;
508 
513 @property (nonatomic, MB_STRONG) UIColor *progressColor;
514 
515 @end
MBProgressHUDMode mode
Definition: MBProgressHUD.h:284
UIColor * progressTintColor
Definition: MBProgressHUD.h:471
NSString * detailsLabelText
Definition: MBProgressHUD.h:317
BOOL removeFromSuperViewOnHide
Definition: MBProgressHUD.h:390
float margin
Definition: MBProgressHUD.h:345
Definition: MBProgressHUD.h:490
float cornerRadius
Definition: MBProgressHUD.h:351
float progress
Definition: MBProgressHUD.h:465
float opacity
Definition: MBProgressHUD.h:322
id< MBProgressHUDDelegate > delegate
Definition: MBProgressHUD.h:304
Definition: MBProgressHUD.h:445
UIColor * detailsLabelColor
Definition: MBProgressHUD.h:410
UIColor * labelColor
Definition: MBProgressHUD.h:400
NSString * labelText
Definition: MBProgressHUD.h:311
Definition: MBProgressHUD.h:460
UIColor * color
Definition: MBProgressHUD.h:329
float xOffset
Definition: MBProgressHUD.h:334
UIView * customView
Definition: MBProgressHUD.h:297
CGSize size
Definition: MBProgressHUD.h:434
UIFont * detailsLabelFont
Definition: MBProgressHUD.h:405
UIColor * activityIndicatorColor
Definition: MBProgressHUD.h:416
BOOL square
Definition: MBProgressHUD.h:440
UIFont * labelFont
Definition: MBProgressHUD.h:395
MBProgressHUDAnimation animationType
Definition: MBProgressHUD.h:291
BOOL taskInProgress
Definition: MBProgressHUD.h:384
CGSize minSize
Definition: MBProgressHUD.h:426
float yOffset
Definition: MBProgressHUD.h:339
float minShowTime
Definition: MBProgressHUD.h:374
BOOL dimBackground
Definition: MBProgressHUD.h:356
Definition: MBProgressHUD.h:111
float progress
Definition: MBProgressHUD.h:421
UIColor * backgroundTintColor
Definition: MBProgressHUD.h:477