Library Mobile API Reference for iPhone  MicroStrategy 2019
MBProgressHUD.h
Go to the documentation of this file.
1 //
2 // MBProgressHUD.h
3 // Version 0.9.2
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) 2009-2015 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 NS_ENUM(NSInteger, MBProgressHUDMode) {
38  MBProgressHUDModeIndeterminate,
40  MBProgressHUDModeDeterminate,
42  MBProgressHUDModeDeterminateHorizontalBar,
44  MBProgressHUDModeAnnularDeterminate,
46  MBProgressHUDModeCustomView,
48  MBProgressHUDModeText
49 };
50 
51 typedef NS_ENUM(NSInteger, MBProgressHUDAnimation) {
53  MBProgressHUDAnimationFade,
55  MBProgressHUDAnimationZoom,
56  MBProgressHUDAnimationZoomOut = MBProgressHUDAnimationZoom,
57  MBProgressHUDAnimationZoomIn
58 };
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 
126 + (MB_INSTANCETYPE)showHUDAddedTo:(UIView *)view animated:(BOOL)animated;
127 
141 + (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated;
142 
156 + (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated;
157 
164 + (MB_INSTANCETYPE)HUDForView:(UIView *)view;
165 
172 + (NSArray *)allHUDsForView:(UIView *)view;
173 
181 - (id)initWithWindow:(UIWindow *)window;
182 
190 - (id)initWithView:(UIView *)view;
191 
202 - (void)show:(BOOL)animated;
203 
213 - (void)hide:(BOOL)animated;
214 
225 - (void)hide:(BOOL)animated afterDelay:(NSTimeInterval)delay;
226 
239 - (void)showWhileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated;
240 
241 #if NS_BLOCKS_AVAILABLE
242 
248 - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block;
249 
255 - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block completionBlock:(MBProgressHUDCompletionBlock)completion;
256 
262 - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue;
263 
275 - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue
276  completionBlock:(MBProgressHUDCompletionBlock)completion;
277 
281 @property (copy) MBProgressHUDCompletionBlock completionBlock;
282 
283 #endif
284 
290 @property (assign) MBProgressHUDMode mode;
291 
297 @property (assign) MBProgressHUDAnimation animationType;
298 
303 @property (MB_STRONG) UIView *customView;
304 
310 @property (MB_WEAK) id<MBProgressHUDDelegate> delegate;
311 
317 @property (copy) NSString *labelText;
318 
323 @property (copy) NSString *detailsLabelText;
324 
328 @property (assign) float opacity;
329 
335 @property (MB_STRONG) UIColor *color;
336 
340 @property (assign) float xOffset;
341 
345 @property (assign) float yOffset;
346 
351 @property (assign) float margin;
352 
357 @property (assign) float cornerRadius;
358 
362 @property (assign) BOOL dimBackground;
363 
364 /*
365  * Grace period is the time (in seconds) that the invoked method may be run without
366  * showing the HUD. If the task finishes before the grace time runs out, the HUD will
367  * not be shown at all.
368  * This may be used to prevent HUD display for very short tasks.
369  * Defaults to 0 (no grace time).
370  * Grace time functionality is only supported when the task status is known!
371  * @see taskInProgress
372  */
373 @property (assign) float graceTime;
374 
380 @property (assign) float minShowTime;
381 
390 @property (assign) BOOL taskInProgress;
391 
396 @property (assign) BOOL removeFromSuperViewOnHide;
397 
401 @property (MB_STRONG) UIFont* labelFont;
402 
406 @property (MB_STRONG) UIColor* labelColor;
407 
411 @property (MB_STRONG) UIFont* detailsLabelFont;
412 
416 @property (MB_STRONG) UIColor* detailsLabelColor;
417 
422 @property (MB_STRONG) UIColor *activityIndicatorColor;
423 
427 @property (assign) float progress;
428 
432 @property (assign) CGSize minSize;
433 
434 
440 @property (atomic, assign, readonly) CGSize size;
441 
442 
446 @property (assign, getter = isSquare) BOOL square;
447 
448 @end
449 
450 
451 @protocol MBProgressHUDDelegate <NSObject>
452 
453 @optional
454 
458 - (void)hudWasHidden:(MBProgressHUD *)hud;
459 
460 @end
461 
462 
466 @interface MBRoundProgressView : UIView
467 
471 @property (nonatomic, assign) float progress;
472 
477 @property (nonatomic, MB_STRONG) UIColor *progressTintColor;
478 
483 @property (nonatomic, MB_STRONG) UIColor *backgroundTintColor;
484 
485 /*
486  * Display mode - NO = round or YES = annular. Defaults to round.
487  */
488 @property (nonatomic, assign, getter = isAnnular) BOOL annular;
489 
490 @end
491 
492 
496 @interface MBBarProgressView : UIView
497 
501 @property (nonatomic, assign) float progress;
502 
507 @property (nonatomic, MB_STRONG) UIColor *lineColor;
508 
513 @property (nonatomic, MB_STRONG) UIColor *progressRemainingColor;
514 
519 @property (nonatomic, MB_STRONG) UIColor *progressColor;
520 
521 @end
float graceTime
Definition: MBProgressHUD.h:373
MBProgressHUDMode mode
Definition: MBProgressHUD.h:290
UIColor * progressTintColor
Definition: MBProgressHUD.h:477
NSString * detailsLabelText
Definition: MBProgressHUD.h:323
BOOL removeFromSuperViewOnHide
Definition: MBProgressHUD.h:396
float margin
Definition: MBProgressHUD.h:351
Definition: MBProgressHUD.h:496
#define MB_INSTANCETYPE
Definition: MBProgressHUD.h:65
float cornerRadius
Definition: MBProgressHUD.h:357
float progress
Definition: MBProgressHUD.h:471
float opacity
Definition: MBProgressHUD.h:328
id< MBProgressHUDDelegate > delegate
Definition: MBProgressHUD.h:310
typedef NS_ENUM(NSInteger, MBProgressHUDMode)
Definition: MBProgressHUD.h:36
UIColor * detailsLabelColor
Definition: MBProgressHUD.h:416
UIColor * labelColor
Definition: MBProgressHUD.h:406
NSString * labelText
Definition: MBProgressHUD.h:317
Definition: MBProgressHUD.h:466
UIColor * color
Definition: MBProgressHUD.h:335
float xOffset
Definition: MBProgressHUD.h:340
UIView * customView
Definition: MBProgressHUD.h:303
BOOL annular
Definition: MBProgressHUD.h:488
CGSize size
Definition: MBProgressHUD.h:440
#define MB_WEAK
Definition: MBProgressHUD.h:83
UIFont * detailsLabelFont
Definition: MBProgressHUD.h:411
UIColor * activityIndicatorColor
Definition: MBProgressHUD.h:422
BOOL square
Definition: MBProgressHUD.h:446
UIFont * labelFont
Definition: MBProgressHUD.h:401
MBProgressHUDAnimation animationType
Definition: MBProgressHUD.h:297
BOOL taskInProgress
Definition: MBProgressHUD.h:390
CGSize minSize
Definition: MBProgressHUD.h:432
float yOffset
Definition: MBProgressHUD.h:345
float minShowTime
Definition: MBProgressHUD.h:380
BOOL dimBackground
Definition: MBProgressHUD.h:362
Definition: MBProgressHUD.h:111
float progress
Definition: MBProgressHUD.h:427
#define MB_STRONG
Definition: MBProgressHUD.h:73
UIColor * backgroundTintColor
Definition: MBProgressHUD.h:483