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