]>
Commit | Line | Data |
---|---|---|
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 | @end | |
17 | ||
18 | @implementation CYViewController | |
19 | ||
20 | - (void) setDelegate:(id)delegate { | |
21 | delegate_ = delegate; | |
22 | } | |
23 | ||
24 | - (id) delegate { | |
25 | return delegate_; | |
26 | } | |
27 | ||
28 | - (void) viewWillAppear:(BOOL)animated { | |
29 | [super viewWillAppear:animated]; | |
30 | ||
31 | // Load on first appearance. We don't need to set the loaded flag here | |
32 | // because it is set for us the first time -reloadData is called. | |
33 | if (![self hasLoaded]) | |
34 | [self reloadData]; | |
35 | } | |
36 | ||
37 | - (BOOL) hasLoaded { | |
38 | return loaded_; | |
39 | } | |
40 | ||
41 | - (void) releaseSubviews { | |
42 | // Do nothing. | |
43 | } | |
44 | ||
45 | - (void) setView:(UIView *)view { | |
46 | // Nasty hack for 2.x-compatibility. In 3.0+, we can and | |
47 | // should just override -viewDidUnload instead. | |
48 | if (view == nil) | |
49 | [self releaseSubviews]; | |
50 | ||
51 | [super setView:view]; | |
52 | } | |
53 | ||
54 | - (void) reloadData { | |
55 | // This is called automatically on the first appearance of a controller, | |
56 | // or any other time it needs to reload the information shown. However (!), | |
57 | // this is not called by any tab bar or navigation controller's -reloadData | |
58 | // method unless this controller returns YES from -hadLoaded. | |
59 | loaded_ = YES; | |
60 | } | |
61 | ||
62 | - (NSURL *) navigationURL { | |
63 | return nil; | |
64 | } | |
65 | ||
66 | - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { | |
67 | return IsWildcat_ || orientation == UIInterfaceOrientationPortrait; | |
68 | } | |
69 | ||
70 | @end |