Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 157 lines (134 sloc) 5.143 kb
1773289 @matej General code cleanup.
matej authored
1 //
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
2 // DZProgressController.h
3 // DZProgressController
1773289 @matej General code cleanup.
matej authored
4 //
74dfbb4 @zwaldowski Use weak references instead of unsafe_unretained. Licensing crud.
authored
5 // (c) 2012 Zachary Waldowski.
ebaf638 @zwaldowski Licensing and disclaimer detritus.
authored
6 // (c) 2009-2011 Matej Bukovinski and contributors.
7 // This code is licensed under MIT. See LICENSE for more information.
0a5c619 @jdg First commit
jdg authored
8 //
9
8ae5021 @zwaldowski Retina success image.
authored
10 #import <UIKit/UIKit.h>
11
69e2905 @zwaldowski Constant values for customView that represent success and error image vi...
authored
12 /** When set as the HUD's custom view, the HUD will show a check image. **/
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
13 extern const id DZProgressControllerSuccessView;
69e2905 @zwaldowski Constant values for customView that represent success and error image vi...
authored
14
15 /** When set as the HUD's custom view, the HUD will show an error image. **/
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
16 extern const id DZProgressControllerErrorView;
69e2905 @zwaldowski Constant values for customView that represent success and error image vi...
authored
17
1773289 @matej General code cleanup.
matej authored
18 typedef enum {
fee25a5 Adding offsets and delays. Offsets work, but don't protect against over/...
Austin Ziegler authored
19 /** Progress is shown using an UIActivityIndicatorView. This is the default. */
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
20 DZProgressControllerModeIndeterminate,
ec73138 @zwaldowski Hard fork.
authored
21 /** Progress is shown using a DZRoundProgressView. */
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
22 DZProgressControllerModeDeterminate,
6408e7f @matej Added a Custom View mode.
matej authored
23 /** Shows a custom view */
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
24 DZProgressControllerModeCustomView
25 } DZProgressControllerMode;
059cf87 Importing 0.31 from zip download
Austin Ziegler authored
26
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
27 @interface DZProgressController : UIViewController <UIAppearanceContainer>
0a5c619 @jdg First commit
jdg authored
28
eedc69d @matej Class methods for quickly showing and hiding the HUD.
matej authored
29 /**
f631301 @zwaldowski A simpler chain of class methods.
authored
30 * Creates a new HUD and shows it on the current window.
eedc69d @matej Class methods for quickly showing and hiding the HUD.
matej authored
31 *
f631301 @zwaldowski A simpler chain of class methods.
authored
32 * @returns A reference to the created HUD.
33 *
34 * @see showOnView:
35 * @see hide
36 */
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
37 + (DZProgressController *)show;
eedc69d @matej Class methods for quickly showing and hiding the HUD.
matej authored
38
39 /**
f631301 @zwaldowski A simpler chain of class methods.
authored
40 * Shows a HUD on the current window using while executing a block in the background.
eedc69d @matej Class methods for quickly showing and hiding the HUD.
matej authored
41 *
f631301 @zwaldowski A simpler chain of class methods.
authored
42 * The block is executed from a separate queue unrelated to the UI main thread. The HUD is passed
43 * as an argument to the block for progress updates, changes, and so on. The HUD should not be
44 * dismissed from within the block; instead, bail out using a return statement.
45 *
46 * @param block A code block to be executed. Should not be NULL.
eedc69d @matej Class methods for quickly showing and hiding the HUD.
matej authored
47 *
f631301 @zwaldowski A simpler chain of class methods.
authored
48 * @see showWithText:whileExecuting:
eedc69d @matej Class methods for quickly showing and hiding the HUD.
matej authored
49 */
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
50 + (void)showWhileExecuting:(void(^)(DZProgressController *))block;
eedc69d @matej Class methods for quickly showing and hiding the HUD.
matej authored
51
6408e7f @matej Added a Custom View mode.
matej authored
52 /**
9ce16de @zwaldowski Convenience class method for showing a simple block.
authored
53 * Shows a HUD on the current window using while executing a block in the background.
54 *
55 * The block is executed from a separate queue unrelated to the UI main thread. The HUD is passed
56 * as an argument to the block for progress updates, changes, and so on. The HUD should not be
57 * dismissed from within the block; instead, bail out using a return statement.
58 *
59 * @param statusText The text for the main label. Send an empty string to not show the label at all.
60 * @param block A code block to be executed. Should not be NULL.
61 *
62 * @see label
63 * @see showWhileExecuting:
64 */
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
65 + (void)showWithText:(NSString *)statusText whileExecuting:(void(^)(DZProgressController *))block;
9ce16de @zwaldowski Convenience class method for showing a simple block.
authored
66
67 /**
efea9fd @zwaldowski Follow through on name change.
authored
68 * The view to be shown when the HUD is set to DZProgressControllerModeCustomView.
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
69 * For best results, use a 37x37 pt view (so the bounds match the default indicator bounds).
550c85b @zwaldowski Remove the need for a designated initializer. (Just use -init or +new.)
authored
70 *
efea9fd @zwaldowski Follow through on name change.
authored
71 * Pass `DZProgressControllerSuccessView` for an image view with a check.
72 * Pass `DZProgressControllerErrorView`, for an image view with an error symbol.
550c85b @zwaldowski Remove the need for a designated initializer. (Just use -init or +new.)
authored
73 **/
5b6103f @zwaldowski Go all-ARC. Change all property flags to nonatomic. Use proper naming co...
authored
74 @property (nonatomic, strong) UIView *customView;
75
1773289 @matej General code cleanup.
matej authored
76 /**
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
77 * HUD operation mode. The default is DZProgressControllerModeModeIndeterminate.
29480c6 @matej Support for different animation modes.
matej authored
78 *
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
79 * @see DZProgressControllerMode
0a5c619 @jdg First commit
jdg authored
80 */
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
81 @property (nonatomic) DZProgressControllerMode mode;
82
83 /**
84 * Returns the label used for the main textual content of the HUD.
85 */
86 @property (nonatomic, strong, readonly) UILabel *label;
87
88 /**
9ec7a03 @zwaldowski Remove -setProgress:animated: as the progress is always implicitly anima...
authored
89 * The progress of the progress indicator, from 0.0 to 1.0. Always animated.
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
90 */
91 @property (nonatomic) CGFloat progress;
92
9ce16de @zwaldowski Convenience class method for showing a simple block.
authored
93 /** A callback fired when the HUD is tapped. */
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
94 @property (nonatomic, copy) void(^wasTappedBlock)(DZProgressController *);
9c8b9a1 @zwaldowski wasTappedBlock with tap gesture recognizer.
authored
95
9ce16de @zwaldowski Convenience class method for showing a simple block.
authored
96 /** A callback fired when the HUD is hidden. */
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
97 @property (nonatomic, copy) void(^wasHiddenBlock)(DZProgressController *);
5b6103f @zwaldowski Go all-ARC. Change all property flags to nonatomic. Use proper naming co...
authored
98
19a1e4e @matej Added graceTime, minShowTime and taskInProgress.
matej authored
99 /*
705ed12 @zwaldowski Maximize thread safety for showing.
authored
100 * The show delay is the time (in seconds) that your method may run without the HUD
101 * being shown. If the task finishes before the grace time runs out, the HUD will
9ce16de @zwaldowski Convenience class method for showing a simple block.
authored
102 * not appear at all.
705ed12 @zwaldowski Maximize thread safety for showing.
authored
103 *
104 * Defaults to 0. If you don't set one and still might have a short task,
105 * it is recommended to set a minimum show time instead.
106 *
107 * @see minimumShowTime
19a1e4e @matej Added graceTime, minShowTime and taskInProgress.
matej authored
108 */
705ed12 @zwaldowski Maximize thread safety for showing.
authored
109 @property (nonatomic) NSTimeInterval showDelayTime;
19a1e4e @matej Added graceTime, minShowTime and taskInProgress.
matej authored
110
111 /**
112 * The minimum time (in seconds) that the HUD is shown.
113 * This avoids the problem of the HUD being shown and than instantly hidden.
705ed12 @zwaldowski Maximize thread safety for showing.
authored
114 *
cfce77a @zwaldowski Set a default minimum show time.
authored
115 * Defaults to 1.5. If you don't set one and your task might run short,
705ed12 @zwaldowski Maximize thread safety for showing.
authored
116 * it is recommended to instead set a show delay time.
117 *
118 * @see showDelayTime
19a1e4e @matej Added graceTime, minShowTime and taskInProgress.
matej authored
119 */
705ed12 @zwaldowski Maximize thread safety for showing.
authored
120 @property (nonatomic) NSTimeInterval minimumShowTime;
19a1e4e @matej Added graceTime, minShowTime and taskInProgress.
matej authored
121
90a7b66 @zwaldowski Force animation for showing and hiding.
authored
122 /**
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
123 * Returns whether or not the HUD is currently visible.
90a7b66 @zwaldowski Force animation for showing and hiding.
authored
124 */
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
125 @property (nonatomic, readonly, getter = isVisible) BOOL visible;
5b6103f @zwaldowski Go all-ARC. Change all property flags to nonatomic. Use proper naming co...
authored
126
90a7b66 @zwaldowski Force animation for showing and hiding.
authored
127 /**
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
128 * Display the HUD. All user interaction with the app is disabled while the HUD is shown.
201c6cd @jdg Add hide/show functions.
jdg authored
129 */
90a7b66 @zwaldowski Force animation for showing and hiding.
authored
130 - (void)show;
201c6cd @jdg Add hide/show functions.
jdg authored
131
1773289 @matej General code cleanup.
matej authored
132 /**
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
133 * Hide the HUD when your task completes.
62771b4 @matej Added a new method (hid:afterDelay:).
matej authored
134 */
90a7b66 @zwaldowski Force animation for showing and hiding.
authored
135 - (void)hide;
62771b4 @matej Added a new method (hid:afterDelay:).
matej authored
136
137 /**
96d2039 @zwaldowski Improve documentation.
authored
138 * Shows the HUD while a task is executing in a background queue, then hides it.
059cf87 Importing 0.31 from zip download
Austin Ziegler authored
139 *
81eaaf8 @zwaldowski Migrate to DZProgressController, deriving from UIViewController instead ...
authored
140 * This method also takes care of an autorelease pool so your method does not have
96d2039 @zwaldowski Improve documentation.
authored
141 * to be concerned with setting one up.
059cf87 Importing 0.31 from zip download
Austin Ziegler authored
142 *
96d2039 @zwaldowski Improve documentation.
authored
143 * @param block A code block to be executed while the HUD is shown.
0a5c619 @jdg First commit
jdg authored
144 */
7ea39d3 @zwaldowski Clean up block types and the demo's selectors.
authored
145 - (void)showWhileExecuting:(void(^)(void))block;
1773289 @matej General code cleanup.
matej authored
146
35d15e2 @zwaldowski Add a method that coalesces changes into an animation. Improve setter be...
authored
147 /**
148 * Coalesces changes to the HUD (mode, view, text, fonts) into a single animation.
149 *
9ce16de @zwaldowski Convenience class method for showing a simple block.
authored
150 * This method is non-blocking, but the HUD cannot be hidden while animations are ongoing.
35d15e2 @zwaldowski Add a method that coalesces changes into an animation. Improve setter be...
authored
151 *
152 * @param A code block of changes to the HUD. Will be executed from within a transition method.
153 */
7ea39d3 @zwaldowski Clean up block types and the demo's selectors.
authored
154 - (void)performChanges:(void(^)(void))animations;
35d15e2 @zwaldowski Add a method that coalesces changes into an animation. Improve setter be...
authored
155
0a5c619 @jdg First commit
jdg authored
156 @end
Something went wrong with that request. Please try again.