Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 130 lines (105 sloc) 4.94 kb
180bc04 ettore rename categories to a more standard naming convention, and CLCGTVVC to ...
authored
1 // Copyright (c) 2012, Ettore Pasquini
2 // Copyright (c) 2012, Cubelogic
3 // All rights reserved.
489dc7f ettore a base vc that handles spinny wheel
authored
4 //
180bc04 ettore rename categories to a more standard naming convention, and CLCGTVVC to ...
authored
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // - Redistributions of source code must retain the above copyright notice, this
9 // list of conditions and the following disclaimer.
10 // - Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 // POSSIBILITY OF SUCH DAMAGE.
489dc7f ettore a base vc that handles spinny wheel
authored
25 //
26 // Created by Ettore Pasquini on 5/4/11.
27 //
28
29 #import <UIKit/UIKit.h>
30
31
1df740a ettore moved loadState to CLCGVC
authored
32 enum CLCGLoadingState {
33 CLCG_NOT_LOADED,
34 CLCG_LOADING,
35 CLCG_LOADED,
36 CLCG_OUTDATED,
37 CLCG_LOAD_ERROR,
38 };
39
40
bd607f4 ettore Centered spinner and added fixes for usage as popover.
authored
41 /**
42 * If your CLCGVC view controller is presented as content inside of a
43 * UIPopoverController, and you want to be notified when the user
44 * performs an action inside your content view controller (such as hitting a
45 * button that should close the popover programmatically), then you can use
46 * this delegate to let (e.g.) the parent object that opened the popover
47 * know that it is now time to dismiss it. This is because when you close
48 * a popover programmatically (UIPopoverController::dismissPopoverAnimated:)
49 * the UIPopoverControllerDelegate::popoverControllerDidDismissPopover:
50 * method is not called.
51 *
52 * TODO: perhaps it'd be cleaner to extend UIPopoverController and have a new
53 * method to UIPopoverControllerDelegate. (It might be dangerous to change the
54 * behavior of UIPopoverController::dismissPopoverAnimated: and call
55 * popoverControllerDidDismissPopover: on the delegate.)
56 */
57 @protocol CLCGPopoverContentDelegate
58 -(void)didInvokeDismissAction:(UIViewController*)vc_in_popover;
ad18ddc ettore add popoverContentSizeDidChange: to CLCGPopoverContentDelegate protocol
authored
59 -(void)popoverContentSizeDidChange:(CGSize)size;
bd607f4 ettore Centered spinner and added fixes for usage as popover.
authored
60 @end
61
62
489dc7f ettore a base vc that handles spinny wheel
authored
63 @interface CLCGVC : UIViewController
3b546c6 ettore added way of displaying empty (or error) message in the middle of the CL...
authored
64
d5e5b23 ettore add ability to show some text in loading view
authored
65 //------------------------------------------------------------------------------
66 #pragma mark - Loading logic
67
9328ea2 ettore convert all files to ARC
authored
68 /*!
871ec71 ettore comments
authored
69 Subclasses should set the loading state accordingly, before/during/after
70 loading content, depending what loading means in each VC. E.g. it should be
71 set to CLCG_LOADED even if there was no api call being performed.
72 */
1df740a ettore moved loadState to CLCGVC
authored
73 @property(nonatomic,assign) enum CLCGLoadingState loadState;
871ec71 ettore comments
authored
74
d5e5b23 ettore add ability to show some text in loading view
authored
75 /*!
76 @discussion Subclasses should override this method and initiate here any
77 asynchronous server side call. The default implementation does nothing.
78 */
79 -(void)loadFromServerIfNeeded;
80
81
82 /*! Forces a reload from the server. */
83 -(void)reload;
84
85 //------------------------------------------------------------------------------
86 #pragma mark - Loading view / Spinner
87
180bc04 ettore rename categories to a more standard naming convention, and CLCGTVVC to ...
authored
88 @property(nonatomic,strong) IBOutlet UIView *spinnerContainer;
89 @property(nonatomic,strong) IBOutlet UIActivityIndicatorView *spinner;
58c5d7e ettore Refactored CLCGVC to create its own activity indicator, with some config...
authored
90 @property(nonatomic) UIActivityIndicatorViewStyle spinnerStyle;
180bc04 ettore rename categories to a more standard naming convention, and CLCGTVVC to ...
authored
91 @property(nonatomic,strong) UIColor *spinnerBackgroundColor;
92 @property(nonatomic,strong) IBOutlet UILabel *spinnerLabel1;
93 @property(nonatomic,strong) IBOutlet UILabel *spinnerLabel2;
d5e5b23 ettore add ability to show some text in loading view
authored
94
95 /**
96 * If show == YES, shows and aligns the spinny indicator to the center
97 * of the screen.
98 * If show == NO, removes the spinny indicator if it was displayed, or do
99 * nothing otherwise.
100 */
101 -(void)showLoadingView:(BOOL)show;
102
103 //------------------------------------------------------------------------------
a97af1b ettore clean up previous error/empty states when when (re)loading
authored
104 #pragma mark - Displaying empty or error states
d5e5b23 ettore add ability to show some text in loading view
authored
105
180bc04 ettore rename categories to a more standard naming convention, and CLCGTVVC to ...
authored
106 @property(nonatomic,strong) IBOutlet UIView *emptyContainer;
107 @property(nonatomic,strong) IBOutlet UILabel *emptyLabel;
3b546c6 ettore added way of displaying empty (or error) message in the middle of the CL...
authored
108
109 /**
110 * If msg is non-nil, this method shows and aligns the given message to the
111 * center of the screen. Otherwise, it removes the message if it was displayed.
112 */
113 -(void)showEmptyMessage:(NSString*)msg;
114
d5e5b23 ettore add ability to show some text in loading view
authored
115 //------------------------------------------------------------------------------
116 #pragma mark - Misc
3b546c6 ettore added way of displaying empty (or error) message in the middle of the CL...
authored
117
d5e5b23 ettore add ability to show some text in loading view
authored
118 @property(nonatomic,weak) id<CLCGPopoverContentDelegate> popoverContentDelegate;
49ef5b2 ettore add explicit method to reload from server
authored
119
08ed4d5 ettore moved loadFromServerIfNeeded to CLCGVC. Now CLCGTVVC only deals with tab...
authored
120 /**
9458c25 ettore added releaseRetainedSubviews method, called in dealloc and viewDidUnloa...
authored
121 * Releases all the retained subviews of this view controller. This is called
122 * by dealloc and viewDidUnload.
123 * Subclasses should override this method and release their subviews here.
124 */
125 -(void)releaseRetainedSubviews;
126
a13675f ettore `some comments
authored
127
489dc7f ettore a base vc that handles spinny wheel
authored
128 @end
a13675f ettore `some comments
authored
129
Something went wrong with that request. Please try again.