1 /* Cydia - iPhone UIKit Front-End for Debian APT
2 * Copyright (C) 2008-2014 Jay Freeman (saurik)
5 /* GNU General Public License, Version 3 {{{ */
7 * Cydia is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation, either version 3 of the License,
10 * or (at your option) any later version.
12 * Cydia is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Cydia. If not, see <http://www.gnu.org/licenses/>.
22 #include "CyteKit/ViewController.h"
24 #include <Foundation/Foundation.h>
25 #include <UIKit/UIKit.h>
27 #include "iPhonePrivate.h"
29 extern bool IsWildcat_;
31 @implementation UIViewController (Cydia)
42 if (UIViewController *modal = [self modalViewController])
46 - (UIViewController *) parentOrPresentingViewController {
47 if (UIViewController *parent = [self parentViewController])
49 if ([self respondsToSelector:@selector(presentingViewController)])
50 return [self presentingViewController];
56 @implementation CyteViewController
58 - (void) setDelegate:(id)delegate {
66 - (void) viewWillAppear:(BOOL)animated {
67 [super viewWillAppear:animated];
69 // Load on first appearance. We don't need to set the loaded flag here
70 // because it is set for us the first time -reloadData is called.
71 if (![self hasLoaded])
79 - (void) releaseSubviews {
83 - (void) setView:(UIView *)view {
84 // Nasty hack for 2.x-compatibility. In 3.0+, we can and
85 // should just override -viewDidUnload instead.
87 [self releaseSubviews];
95 // This is called automatically on the first appearance of a controller,
96 // or any other time it needs to reload the information shown. However (!),
97 // this is not called by any tab bar or navigation controller's -reloadData
98 // method unless this controller returns YES from -hadLoaded.
102 - (void) unloadData {
107 - (NSURL *) navigationURL {
111 - (NSUInteger) supportedInterfaceOrientations {
112 return IsWildcat_ ? UIInterfaceOrientationMaskAll : UIInterfaceOrientationMaskPortrait;
115 - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
116 return ([self supportedInterfaceOrientations] & 1 << orientation) != 0;
119 - (BOOL) shouldAutorotate {
123 - (void) setPageColor:(UIColor *)color {
125 color = [UIColor groupTableViewBackgroundColor];