]> git.saurik.com Git - cydia.git/blob - UICaboodle/RVPage.mm
Clean up UIProgressHUD code.
[cydia.git] / UICaboodle / RVPage.mm
1 #import "RVPage.h"
2
3 #import <Foundation/Foundation.h>
4 #import <UIKit/UIKit.h>
5
6 #import "RVBook.h"
7
8 extern bool IsWildcat_;
9
10 @implementation UIViewController (Cydia)
11
12 - (BOOL) hasLoaded {
13 return YES;
14 }
15
16 - (void) reloadData {
17 }
18
19 - (void) unloadData {
20 }
21
22 @end
23
24 @implementation CYViewController
25
26 - (void) setDelegate:(id)delegate {
27 delegate_ = delegate;
28 }
29
30 - (id) delegate {
31 return delegate_;
32 }
33
34 - (void) viewWillAppear:(BOOL)animated {
35 [super viewWillAppear:animated];
36
37 // Load on first appearance. We don't need to set the loaded flag here
38 // because it is set for us the first time -reloadData is called.
39 if (![self hasLoaded])
40 [self reloadData];
41 }
42
43 - (BOOL) hasLoaded {
44 return loaded_;
45 }
46
47 - (void) releaseSubviews {
48 // Do nothing.
49 }
50
51 - (void) setView:(UIView *)view {
52 // Nasty hack for 2.x-compatibility. In 3.0+, we can and
53 // should just override -viewDidUnload instead.
54 if (view == nil)
55 [self releaseSubviews];
56
57 [super setView:view];
58 }
59
60 - (void) reloadData {
61 [super reloadData];
62
63 // This is called automatically on the first appearance of a controller,
64 // or any other time it needs to reload the information shown. However (!),
65 // this is not called by any tab bar or navigation controller's -reloadData
66 // method unless this controller returns YES from -hadLoaded.
67 loaded_ = YES;
68 }
69
70 - (void) unloadData {
71 loaded_ = NO;
72 [super unloadData];
73 }
74
75 - (NSURL *) navigationURL {
76 return nil;
77 }
78
79 - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
80 return IsWildcat_ || orientation == UIInterfaceOrientationPortrait;
81 }
82
83 @end