#import "RVBook.h"
-@implementation RVPage
+extern bool IsWildcat_;
-- (NSString *) title {
- [self doesNotRecognizeSelector:_cmd];
- return nil;
-}
-
-- (NSString *) backButtonTitle {
- return nil;
-}
-
-- (NSString *) leftButtonTitle {
- return nil;
-}
+@implementation UIViewController (Cydia)
-- (id) rightButtonTitle {
- return nil;
+- (BOOL) hasLoaded {
+ return YES;
}
-- (UINavigationButtonStyle) leftButtonStyle {
- return [self leftButtonTitle] == nil ? UINavigationButtonStyleBack : UINavigationButtonStyleNormal;
-}
+@end
-- (UINavigationButtonStyle) rightButtonStyle {
- return UINavigationButtonStyleNormal;
-}
+@implementation CYViewController
-- (void) _rightButtonClicked {
- [self doesNotRecognizeSelector:_cmd];
+- (void) setDelegate:(id)delegate {
+ delegate_ = delegate;
}
-- (void) _leftButtonClicked {
- [self doesNotRecognizeSelector:_cmd];
+- (id) delegate {
+ return delegate_;
}
-- (UIView *) accessoryView {
- return nil;
-}
+- (void) viewWillAppear:(BOOL)animated {
+ [super viewWillAppear:animated];
-- (UIImage *) rightButtonImage {
- return nil;
+ // Load on first appearance. We don't need to set the loaded flag here
+ // because it is set for us the first time -reloadData is called.
+ if (![self hasLoaded])
+ [self reloadData];
}
-- (void) setPageActive:(BOOL)active {
+- (BOOL) hasLoaded {
+ return loaded_;
}
-- (void) resetViewAnimated:(BOOL)animated {
- [self doesNotRecognizeSelector:_cmd];
+- (void) releaseSubviews {
+ // Do nothing.
}
-- (void) setBackButtonTitle:(NSString *)title {
- [book_ setBackButtonTitle:title forPage:self];
-}
+- (void) setView:(UIView *)view {
+ // Nasty hack for 2.x-compatibility. In 3.0+, we can and
+ // should just override -viewDidUnload instead.
+ if (view == nil)
+ [self releaseSubviews];
-- (void) reloadButtons {
- [book_ reloadButtonsForPage:self];
+ [super setView:view];
}
- (void) reloadData {
+ // This is called automatically on the first appearance of a controller,
+ // or any other time it needs to reload the information shown. However (!),
+ // this is not called by any tab bar or navigation controller's -reloadData
+ // method unless this controller returns YES from -hadLoaded.
+ loaded_ = YES;
}
-- (id) initWithBook:(RVBook *)book {
- if ((self = [super initWithFrame:[book pageBounds]]) != nil) {
- book_ = book;
- } return self;
-}
-
-- (void) setDelegate:(id)delegate {
- delegate_ = delegate;
+- (NSURL *) navigationURL {
+ return nil;
}
-- (void) setBook:(RVBook *)book {
- book_ = book;
+- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
+ return IsWildcat_ || orientation == UIInterfaceOrientationPortrait;
}
@end