summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-03-21 03:35:20 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-21 03:35:49 -0700
commit2fcb1d49a0be54a0d43a4984e6e50e0a2d8d77f9 (patch)
tree99b247e00df126fc99bb7f069072ecf93851cf79
parentca6299305858884d89c8be7cca2ab5c67ee58c66 (diff)
Work around stupid 2.x UINavigationController behavior.
-rw-r--r--MobileCydia.mm22
-rw-r--r--iPhonePrivate.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 41cc4e7..dd7b14a 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -6747,6 +6747,20 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
@implementation CYTabBarController
+- (void) didReceiveMemoryWarning {
+ [super didReceiveMemoryWarning];
+
+ // presenting a UINavigationController on 2.x does not update its transitionView
+ // it thereby will not allow its topViewController to be unloaded by memory pressure
+ if (kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iPhoneOS_3_0) {
+ UIViewController *selected([self selectedViewController]);
+ for (UINavigationController *controller in [self viewControllers])
+ if (controller != selected)
+ if (UIViewController *top = [controller topViewController])
+ [top unloadView];
+ }
+}
+
- (void) setUnselectedViewController:(UIViewController *)transient {
if (kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iPhoneOS_3_0) {
if (transient != nil) {
@@ -6786,6 +6800,14 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
- (void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
if ([self unselectedViewController])
[self setUnselectedViewController:nil];
+
+ // presenting a UINavigationController on 2.x does not update its transitionView
+ // if this view was unloaded, the tranitionView may currently be presenting nothing
+ if (kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iPhoneOS_3_0) {
+ UINavigationController *navigation((UINavigationController *) viewController);
+ [navigation pushViewController:[[[UIViewController alloc] init] autorelease] animated:NO];
+ [navigation popViewControllerAnimated:NO];
+ }
}
- (NSArray *) navigationURLCollection {
diff --git a/iPhonePrivate.h b/iPhonePrivate.h
index 788c3c5..8cc997a 100644
--- a/iPhonePrivate.h
+++ b/iPhonePrivate.h
@@ -296,6 +296,7 @@ typedef enum {
@interface UIViewController (Apple)
- (void) _updateLayoutForStatusBarAndInterfaceOrientation;
+- (void) unloadView;
@end
@interface UIWindow (Apple)